ruby/test/prism
Peter Zhu eca3680c27 [ruby/prism] Fix use of uninitialized value when parsing regexp
Parsing the regexp /\A{/ causes uses an uninitialized value because it
tries to parse it as a range quantifier, so it reads the character after
the closing curly bracket. This is using uninitialized values because
prism strings are not null terminated. This can be seen in the Valgrind
output:

    ==834710== Conditional jump or move depends on uninitialised value(s)
    ==834710==    at 0x5DA010: pm_regexp_parse_range_quantifier (regexp.c:163)
    ==834710==    by 0x5DA010: pm_regexp_parse_quantifier (regexp.c:243)
    ==834710==    by 0x5DAD69: pm_regexp_parse_expression (regexp.c:738)
    ==834710==    by 0x5DAD69: pm_regexp_parse_pattern (regexp.c:761)
    ==834710==    by 0x5DAD69: pm_regexp_parse (regexp.c:773)
    ==834710==    by 0x5A2EE7: parse_regular_expression_named_captures (prism.c:20886)
    ==834710==    by 0x5A2EE7: parse_expression_infix (prism.c:21388)
    ==834710==    by 0x5A5FA5: parse_expression (prism.c:21804)
    ==834710==    by 0x5A64F3: parse_statements (prism.c:13858)
    ==834710==    by 0x5A9730: parse_program (prism.c:22011)
    ==834710==    by 0x576F0D: parse_input_success_p (extension.c:1062)
    ==834710==    by 0x576F0D: parse_success_p (extension.c:1084)

This commit adds checks for the end of the string to
pm_regexp_parse_range_quantifier.

https://github.com/ruby/prism/commit/be6cbc23ef
2024-11-12 14:19:46 +00:00
..
api [ruby/prism] Set contains_keywords flag for implicit gets($/, chomp: true) method call to handle -l CLI option 2024-10-07 15:52:22 +00:00
encoding [ruby/prism] Tests overhaul 2024-05-30 15:18:20 -04:00
errors [ruby/prism] Fix splat after kwsplat 2024-11-08 15:50:54 +00:00
fixtures [ruby/prism] Fix up beginless ranges in method definitions 2024-10-02 14:47:53 +00:00
result [ruby/prism] Do not warn for unused variables on negative lines 2024-10-10 15:13:10 +00:00
ruby [ruby/prism] Relocation 2024-10-16 15:56:01 +00:00
bom_test.rb [ruby/prism] Tests overhaul 2024-05-30 15:18:20 -04:00
errors_test.rb [ruby/prism] Sync from ruby/ruby 2024-07-25 18:59:10 +00:00
fixtures_test.rb [ruby/prism] Tests overhaul 2024-05-30 15:18:20 -04:00
fuzzer_test.rb [ruby/prism] Tests overhaul 2024-05-30 15:18:20 -04:00
heredoc_dedent_test.rb [ruby/prism] Tests overhaul 2024-05-30 15:18:20 -04:00
lex_test.rb [ruby/prism] Tests overhaul 2024-05-30 15:18:20 -04:00
library_symbols_test.rb [ruby/prism] Tests overhaul 2024-05-30 15:18:20 -04:00
locals_test.rb [ruby/prism] Do not leak explicit encoding 2024-09-16 18:57:54 +00:00
magic_comment_test.rb [ruby/prism] Handle single global variable character name 2024-10-03 17:43:11 +00:00
newline_offsets_test.rb [ruby/prism] Tests overhaul 2024-05-30 15:18:20 -04:00
newline_test.rb [ruby/prism] Move Node#type and Node::type documentation 2024-07-11 14:25:54 -04:00
onigmo_test.rb [ruby/prism] Parse all regular expressions 2024-06-05 14:40:03 -04:00
regexp_test.rb [ruby/prism] Fix use of uninitialized value when parsing regexp 2024-11-12 14:19:46 +00:00
snippets_test.rb [ruby/prism] Tests overhaul 2024-05-30 15:18:20 -04:00
test_helper.rb [ruby/prism] Do not leak explicit encoding 2024-09-16 18:57:54 +00:00
unescape_test.rb [ruby/prism] Pass Unicode escapes on to onigmo 2024-08-23 19:18:14 +00:00
version_test.rb [ruby/prism] Accept version shorthand like 3.4 2024-09-24 13:21:36 +00:00