From: "nagachika (Tomoyuki Chikanaga)" Date: 2021-09-18T07:51:52+00:00 Subject: [ruby-core:105339] [Ruby master Bug#17756] StringScanner#charpos makes segmentation fault when target.byteslice returns non string value Issue #17756 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED to 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: DONE ruby_3_0 7b55ff21b52e818819b698326f80158643175645 merged revision(s) 564ccd095a9d7fbe869031dbf666d61dadfdcb03. ---------------------------------------- Bug #17756: StringScanner#charpos makes segmentation fault when target.byteslice returns non string value https://bugs.ruby-lang.org/issues/17756#change-93753 * Author: kachick (Kenichi Kamiya) * Status: Closed * Priority: Normal * ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20] * Backport: 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: DONE ---------------------------------------- GH-PR: https://github.com/ruby/strscan/pull/20 This is a `strscan` issue. I'm not sure the best way of how to handle bundled libraries tickets since they are Gemfied. So I created this ticket just in case. --- This code makes segmentation fault. ```console $ ruby -v ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20] ``` ```ruby require 'strscan' string = 'ruby' scnanner = StringScanner.new(string) pre = Module.new do def byteslice(*args) end end string.singleton_class.prepend(pre) scnanner.charpos ``` ---Files-------------------------------- ruby_2021-03-28-031219_kamiyakenichinoMacBook-puro.crash (31.3 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: