mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:47:45 +00:00
LibJS: Fix fraction substring in parse_time_zone_offset_string()
We're supposed to get the substring from `fraction`, which is guaranteed to have the required length. `fraction_part` is the user-supplied value and trying to get a substring view from 0-9 might crash.
This commit is contained in:
parent
df2ccb3d38
commit
68d80d239b
1 changed files with 1 additions and 1 deletions
|
@ -285,7 +285,7 @@ ThrowCompletionOr<double> parse_time_zone_offset_string(GlobalObject& global_obj
|
||||||
auto fraction = String::formatted("{}000000000", *fraction_part);
|
auto fraction = String::formatted("{}000000000", *fraction_part);
|
||||||
// b. Let nanoseconds be the String value equal to the substring of fraction consisting of the code units with indices 0 (inclusive) through 9 (exclusive).
|
// b. Let nanoseconds be the String value equal to the substring of fraction consisting of the code units with indices 0 (inclusive) through 9 (exclusive).
|
||||||
// c. Set nanoseconds to ! ToIntegerOrInfinity(nanoseconds).
|
// c. Set nanoseconds to ! ToIntegerOrInfinity(nanoseconds).
|
||||||
nanoseconds = MUST(Value(js_string(vm, fraction_part->substring_view(0, 9))).to_integer_or_infinity(global_object));
|
nanoseconds = MUST(Value(js_string(vm, fraction.substring_view(0, 9))).to_integer_or_infinity(global_object));
|
||||||
}
|
}
|
||||||
// 11. Else,
|
// 11. Else,
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue