summaryrefslogtreecommitdiff
path: root/src/lj_strscan.c
diff options
context:
space:
mode:
authorMike Pall <mike>2013-04-29 14:28:10 +0200
committerMike Pall <mike>2013-04-29 14:28:10 +0200
commit09aeca6abf40b246b47e7d83851661294946785c (patch)
tree75ee627ac31bfb56ce666a3a66a4115194fe6a9f /src/lj_strscan.c
parent895a8bc91f1dc0c76f9cc4ae24f11bcb2ba121c3 (diff)
downloadluajit2-09aeca6abf40b246b47e7d83851661294946785c.tar.gz
Fix builtin string to number conversion for overflow digits.
Diffstat (limited to 'src/lj_strscan.c')
-rw-r--r--src/lj_strscan.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lj_strscan.c b/src/lj_strscan.c
index 8d41a3e2..a71b86a2 100644
--- a/src/lj_strscan.c
+++ b/src/lj_strscan.c
@@ -187,7 +187,7 @@ static StrScanFmt strscan_dec(const uint8_t *p, TValue *o,
if (dig) {
uint32_t i = dig;
if (i > STRSCAN_MAXDIG) {
- ex10 -= (int32_t)(i - STRSCAN_MAXDIG);
+ ex10 += (int32_t)(i - STRSCAN_MAXDIG);
i = STRSCAN_MAXDIG;
}
/* Scan unaligned leading digit. */
@@ -280,9 +280,10 @@ static StrScanFmt strscan_dec(const uint8_t *p, TValue *o,
if (d == 0 && i == DPREV(lo)) lo = i;
}
if (cy) {
+ hi = DPREV(hi);
if (xi[DPREV(lo)] == 0) lo = DPREV(lo);
else if (hi == lo) { lo = DPREV(lo); xi[DPREV(lo)] |= xi[lo]; }
- hi = DPREV(hi); xi[hi] = (uint8_t)cy; idig++;
+ xi[hi] = (uint8_t)cy; idig++;
}
}