Commit graph

20 commits

Author SHA1 Message Date
Alexander Momchilov
fa1427a63e [ruby/prism] Enable implicit fall-through errors
03797b84d3
2025-01-11 19:09:05 -05:00
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.

be6cbc23ef
2024-11-12 14:19:46 +00:00
Kevin Newton
d57486cb10 [ruby/prism] Turn off extended mode when parsing extended group
098b3f08bc
2024-08-22 14:43:35 +00:00
Kevin Newton
8fb2227205 [ruby/prism] Properly support parsing regexp in extended mode
bedc4585ed
2024-07-01 14:42:10 +00:00
Kevin Newton
d13112b779 [ruby/prism] Parse all regular expressions
11e0e204ce
2024-06-05 14:40:03 -04:00
Kevin Newton
2a9c20c317 [ruby/prism] Add Onigmo errors for invalid groups
27e7685dd4
2024-06-05 14:40:03 -04:00
Kevin Newton
0406efaf05 [ruby/prism] Add Onigmo error for invalid repeat and empty group name
953601e3c0
2024-06-05 14:40:03 -04:00
Kevin Newton
d604287626 [ruby/prism] Add Onigmo error for empty char-class
2e02fa3b80
2024-06-05 14:40:03 -04:00
Kevin Newton
c3747d5a2e [ruby/prism] Report onigmo errors for depth
e0e8bba8be
2024-06-05 14:40:03 -04:00
Kevin Newton
41f2734644 [ruby/prism] Change pm_regexp_parse to not return boolean
b03afbe857
2024-06-05 14:40:03 -04:00
Kevin Newton
65746055b4 [ruby/prism] Pass prism parser into regexp parser
c19b0fa185
2024-06-05 14:40:03 -04:00
Kevin Newton
ad438623e8 [ruby/prism] Switch regexp parsing to use a callback from named capture groups
29d80e486e
2024-06-05 14:40:03 -04:00
Kevin Newton
ec1eda7b62 [ruby/prism] Account for encoding in regexp named captures
17dc6b6281
2024-02-18 21:42:09 +00:00
Kevin Newton
e2bbbacc23 [ruby/prism] Correctly pass around const pm_encoding_t *
ce4c67fb3a
2023-11-30 21:37:56 -05:00
Nobuyoshi Nakada
368a1cb3c4
Do not use non-ASCII chars in sources
No encodings are guaranteed in C compilers, and other than UTF-8
encodings may be assumed in some platforms, e.g., CP932 on Windows
Japanese edition, and may result in compilation errors.
2023-11-05 02:14:26 +09:00
Kevin Newton
690f3bbf5d [ruby/prism] Last remaining missing C comments
e327449db6
2023-11-01 13:10:29 -04:00
Kevin Newton
1de05631b5 [ruby/prism] Documentation for diagnostics and regexp
16e0579044
2023-11-01 13:10:29 -04:00
Kevin Newton
a8af5d3808 [ruby/prism] Use MatchWriteNode on split InterpolatedREN
ee54244800
2023-10-27 13:40:25 +00:00
Kevin Newton
4f73a7c2f7 Sync to prism rename commits 2023-09-27 13:57:38 -04:00
Kevin Newton
8ab56869a6 Rename YARP filepaths to prism filepaths 2023-09-27 13:57:38 -04:00
Renamed from yarp/regexp.c (Browse further)