From bda32e9440d50630112f45506da8c0fa5e7d5dfb Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sun, 6 Jun 2021 02:29:29 +0300 Subject: [PATCH] LibJS: Parse digits with parse_ascii_base36_digit in parseInt This was accidentally replaced with parse_ascii_hex_digit in bc8d16ad28afb7436bfde1fd0a21faf73d652230 which caused radices above 16 (hex) to fail. --- Userland/Libraries/LibJS/Runtime/GlobalObject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp index 984519552a..0032bce697 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -251,9 +251,9 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_int) } auto parse_digit = [&](u32 code_point, i32 radix) -> Optional { - 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;