Project

General

Profile

Actions

Bug #20989

closed

Segmentation fault in Ripper when lexing `/#{"\xcd"}/`

Added by Earlopain (Earlopain _) 9 days ago. Updated 8 days ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-linux]
[ruby-core:120432]

Description

When I paste this code snippet into irb, I get a segfault: /#{"\xcd"}/. Current master (https://github.com/ruby/ruby/commit/adbbc9109ee71848204b5168a7c1bf604849e5fa) also fails.

Here is a simple reproduction, I attached the full bug as an attachment:

require "ripper"

lexer = Ripper::Lexer.new('/#{"\xcd"}/', '-', 0)
lexer.scan.each
# => /home/earlopain/.rbenv/versions/3.4.1/lib/ruby/3.4.0/ripper/lexer.rb:177: [BUG] Segmentation fault at 0x0000000000000008
# => ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-linux]

Files

bug.txt (27.2 KB) bug.txt Earlopain (Earlopain _), 12/27/2024 06:34 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0