1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

LibJS: Parse digits with parse_ascii_base36_digit in parseInt

This was accidentally replaced with parse_ascii_hex_digit in
bc8d16ad28 which caused radices above
16 (hex) to fail.
This commit is contained in:
Idan Horowitz 2021-06-06 02:29:29 +03:00 committed by Linus Groh
parent 2011fcff24
commit bda32e9440

View file

@ -251,9 +251,9 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_int)
}
auto parse_digit = [&](u32 code_point, i32 radix) -> Optional<i32> {
if (!is_ascii_hex_digit(code_point) || radix <= 0)
if (!is_ascii_alphanumeric(code_point) || radix <= 0)
return {};
auto digit = parse_ascii_hex_digit(code_point);
auto digit = parse_ascii_base36_digit(code_point);
if (digit >= (u32)radix)
return {};
return digit;