mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:47:34 +00:00
LibJS: Check if input was exhausted after parsing UTC offset fraction
Previously parse_time_zone_numeric_utc_offset_syntax() would return true to indicate success when parsing a string with an invalid number of digits in the fractional seconds part (e.g. 23:59:59.9999999999). We need to check if the lexer has any characters remaining, and return false if that's the case.
This commit is contained in:
parent
de07312cc7
commit
f1276144ba
2 changed files with 13 additions and 1 deletions
|
@ -230,7 +230,9 @@ static bool parse_time_zone_numeric_utc_offset_syntax(String const& offset_strin
|
|||
if (!lexer.consume_specific('.') && !lexer.consume_specific(','))
|
||||
return false;
|
||||
fraction = lexer.consume_fractional_seconds();
|
||||
return fraction.has_value();
|
||||
if (!fraction.has_value())
|
||||
return false;
|
||||
return !lexer.tell_remaining();
|
||||
}
|
||||
|
||||
bool is_valid_time_zone_numeric_utc_offset_syntax(String const& offset_string)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue