aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2024-01-25 13:23:48 +0100
committerMike Pall <mike>2024-01-25 13:23:48 +0100
commit343ce0edaf3906a62022936175b2f5410024cbfc (patch)
tree81d1798eb353eef2617e2ebf8eb8aedaf6a7152b
parentf2336c48fa15fe6e166d345ce9ad6a310613107e (diff)
downloadluajit-343ce0edaf3906a62022936175b2f5410024cbfc.tar.gz
luajit-343ce0edaf3906a62022936175b2f5410024cbfc.tar.bz2
luajit-343ce0edaf3906a62022936175b2f5410024cbfc.zip
Fix zero stripping in %g number formatting.
Reported by pwnhacker0x18. #1149
Diffstat (limited to '')
-rw-r--r--src/lj_strfmt_num.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lj_strfmt_num.c b/src/lj_strfmt_num.c
index 79ec0263..c6e776aa 100644
--- a/src/lj_strfmt_num.c
+++ b/src/lj_strfmt_num.c
@@ -454,7 +454,8 @@ static char *lj_strfmt_wfnum(SBuf *sb, SFormat sf, lua_Number n, char *p)
454 prec--; 454 prec--;
455 if (!i) { 455 if (!i) {
456 if (ndlo == ndhi) { prec = 0; break; } 456 if (ndlo == ndhi) { prec = 0; break; }
457 lj_strfmt_wuint9(tail, nd[++ndlo]); 457 ndlo = (ndlo + 1) & 0x3f;
458 lj_strfmt_wuint9(tail, nd[ndlo]);
458 i = 9; 459 i = 9;
459 } 460 }
460 } 461 }