зеркало из https://github.com/github/ruby.git
[ruby/prism] fix: float suffix at end of file
Found by fuzzing. https://github.com/ruby/prism/commit/d77d4fe2b7
This commit is contained in:
Родитель
d6d1a1839a
Коммит
26d11383e5
|
@ -6338,7 +6338,7 @@ lex_optional_float_suffix(pm_parser_t *parser, bool* seen_e) {
|
||||||
(void) (match(parser, '+') || match(parser, '-'));
|
(void) (match(parser, '+') || match(parser, '-'));
|
||||||
*seen_e = true;
|
*seen_e = true;
|
||||||
|
|
||||||
if (pm_char_is_decimal_digit(*parser->current.end)) {
|
if (pm_char_is_decimal_digit(peek(parser))) {
|
||||||
parser->current.end++;
|
parser->current.end++;
|
||||||
parser->current.end += pm_strspn_decimal_number_validate(parser, parser->current.end);
|
parser->current.end += pm_strspn_decimal_number_validate(parser, parser->current.end);
|
||||||
type = PM_TOKEN_FLOAT;
|
type = PM_TOKEN_FLOAT;
|
||||||
|
|
|
@ -35,6 +35,7 @@ module Prism
|
||||||
snippet "escaped unicode at end of file 7", '"\\u3'
|
snippet "escaped unicode at end of file 7", '"\\u3'
|
||||||
snippet "escaped unicode at end of file 8", '"\\u33'
|
snippet "escaped unicode at end of file 8", '"\\u33'
|
||||||
snippet "escaped unicode at end of file 9", '"\\u333'
|
snippet "escaped unicode at end of file 9", '"\\u333'
|
||||||
|
snippet "float suffix at end of file", "1e"
|
||||||
|
|
||||||
snippet "statements node with multiple heredocs", <<~EOF
|
snippet "statements node with multiple heredocs", <<~EOF
|
||||||
for <<A + <<B
|
for <<A + <<B
|
||||||
|
|
Загрузка…
Ссылка в новой задаче