Convert parsed numbers to doubles first in lj_strscan_scan
Regular blua does something similar to that, and it changes how large numeric literals are parsed. It's very rare for those to be used but can still in theory cause synch issues between blua and bluajit clients
This commit is contained in:
1 parent
5cfbc8ce48
commit
3f8fb365a0
1 file changed
+3
-5
@@ -442,7 +442,8 @@ StrScanFmt lj_strscan_scan(const uint8_t *p, MSize len, TValue *o,
|
||||
int cmask = LJ_CHAR_DIGIT;
|
||||
int base = (opt & STRSCAN_OPT_C) && *p == '0' ? 0 : 10;
|
||||
const uint8_t *sp, *dp = NULL;
|
||||
uint32_t dig = 0, hasdig = 0, x = 0;
|
||||
uint32_t dig = 0, hasdig = 0;
|
||||
uint64_t x = 0;
|
||||
int32_t ex = 0;
|
||||
|
||||
/* Determine base and skip leading zeros. */
|
||||
@@ -574,10 +575,7 @@ StrScanFmt lj_strscan_scan(const uint8_t *p, MSize len, TValue *o,
|
||||
fmt = strscan_bin(sp, o, fmt, opt, ex, neg, dig);
|
||||
else
|
||||
#if LJ_INTONLY
|
||||
if (fmt == STRSCAN_NUM)
|
||||
setnumV(o, (lua_Number)(int32_t)(neg ? ~x+1u : x));
|
||||
else
|
||||
setintV(o, (int32_t)(neg ? ~x+1u : x));
|
||||
setintV(o, (int32_t)(double)(neg ? (~x+1u) : x));
|
||||
#else
|
||||
fmt = strscan_dec(sp, o, fmt, opt, ex, neg, dig);
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user