Windows: Use 64 bit conversion for tonumber() with base.

Thanks to yEv3yKw. #911 #1523
This commit is contained in:
Mike Pall 2026-10-14 16:31:01 +02:00
parent 634daf2453
commit 2a8e017ef1

View File

@ -298,13 +298,13 @@ LJLIB_ASM(tonumber) LJLIB_REC(.)
const char *p = strdata(lj_lib_checkstr(L, 1));
char *ep;
unsigned int neg = 0;
unsigned long ul;
unsigned long long ul;
if (base < 2 || base > 36)
lj_err_arg(L, 2, LJ_ERR_BASERNG);
while (lj_char_isspace((unsigned char)(*p))) p++;
if (*p == '-') { p++; neg = 1; } else if (*p == '+') { p++; }
if (lj_char_isalnum((unsigned char)(*p))) {
ul = strtoul(p, &ep, base);
ul = strtoull(p, &ep, base);
if (p != ep) {
while (lj_char_isspace((unsigned char)(*ep))) ep++;
if (*ep == '\0') {