Project

General

Profile

Actions

Bug #17756

open

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

Added by kachick (Kenichi Kamiya) 18 days ago.

Status:
Open
Priority:
Normal
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

No data to display

Actions

Also available in: Atom PDF