mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Fix corner case in string to number conversion.
This commit is contained in:
parent
10caad0261
commit
1b774d9da3
@ -289,14 +289,15 @@ static StrScanFmt strscan_dec(const uint8_t *p, TValue *o,
|
|||||||
|
|
||||||
/* Scale down until no more than 17 or 18 integer part digits remain. */
|
/* Scale down until no more than 17 or 18 integer part digits remain. */
|
||||||
while (idig > 9) {
|
while (idig > 9) {
|
||||||
uint32_t i, cy = 0;
|
uint32_t i = hi, cy = 0;
|
||||||
ex2 += 6;
|
ex2 += 6;
|
||||||
for (i = hi; i != lo; i = DNEXT(i)) {
|
do {
|
||||||
cy += xi[i];
|
cy += xi[i];
|
||||||
xi[i] = (cy >> 6);
|
xi[i] = (cy >> 6);
|
||||||
cy = 100 * (cy & 0x3f);
|
cy = 100 * (cy & 0x3f);
|
||||||
if (xi[i] == 0 && i == hi) hi = DNEXT(hi), idig--;
|
if (xi[i] == 0 && i == hi) hi = DNEXT(hi), idig--;
|
||||||
}
|
i = DNEXT(i);
|
||||||
|
} while (i != lo);
|
||||||
while (cy) {
|
while (cy) {
|
||||||
if (hi == lo) { xi[DPREV(lo)] |= 1; break; }
|
if (hi == lo) { xi[DPREV(lo)] |= 1; break; }
|
||||||
xi[lo] = (cy >> 6); lo = DNEXT(lo);
|
xi[lo] = (cy >> 6); lo = DNEXT(lo);
|
||||||
|
Loading…
Reference in New Issue
Block a user