Explorar el Código

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.
Idan Horowitz hace 4 años
padre
commit
bda32e9440
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      Userland/Libraries/LibJS/Runtime/GlobalObject.cpp

+ 2 - 2
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<i32> {
     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 {};
             return {};
-        auto digit = parse_ascii_hex_digit(code_point);
+        auto digit = parse_ascii_base36_digit(code_point);
         if (digit >= (u32)radix)
         if (digit >= (u32)radix)
             return {};
             return {};
         return digit;
         return digit;