Bug #20989
closedSegmentation fault in Ripper when lexing `/#{"\xcd"}/`
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
Updated by nobu (Nobuyoshi Nakada) 4 months ago
- Status changed from Open to Closed
Applied in changeset commit:git|fb18bb183c24ca82b8f114ed090d62bd69b5df84.
[Bug #20989] Ripper: Pass compile_error
For the universal parser, rb_parser_reg_fragment_check
function is
shared between the parser and ripper. However parser_params
struct
is partially different, and compile_error
function depends on that
part indirectly.
Updated by nobu (Nobuyoshi Nakada) 4 months ago
- Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: REQUIRED
commit:0ccc765 may be needed to backport to all versions.
Updated by k0kubun (Takashi Kokubun) 3 months ago
- Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: REQUIRED to 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: DONE
ruby_3_4 commit:5ba052675f0eefe77dd7ab30bb9ac186f8d82ccb merged revision(s) commit:fb18bb183c24ca82b8f114ed090d62bd69b5df84.
Updated by nagachika (Tomoyuki Chikanaga) about 1 month ago
- Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: DONE to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE