Project

General

Profile

Actions

Bug #17756

closed

StringScanner#charpos makes segmentation fault when target.byteslice returns non string value

Added by kachick (Kenichi Kamiya) about 3 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
[ruby-core:103064]

Description

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.

$ ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
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

Actions #1

Updated by kachick (Kenichi Kamiya) almost 3 years ago

  • Status changed from Open to Closed

Applied in changeset git|564ccd095a9d7fbe869031dbf666d61dadfdcb03.


[ruby/strscan] Fix segmentation fault of StringScanner#charpos when String#byteslice returns non string value [Bug #17756] (#20)

https://github.com/ruby/strscan/commit/92961cde2b

Actions #2

Updated by nagachika (Tomoyuki Chikanaga) over 2 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) over 2 years ago

  • 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0