Visitar URL original
BUG: Possible overflow in 'string.packsize' · lua/lua@45c7ae5 · GitHub
Skip to content

Commit 45c7ae5

Browse files
committed
BUG: Possible overflow in 'string.packsize'
'string.packsize' can overflow result in 32-bit machines using 64-bit integers, as LUA_MAXINTEGER may not fit into size_t.
1 parent 962f444 commit 45c7ae5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎lstrlib.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ static int str_packsize (lua_State *L) {
17261726
luaL_argcheck(L, opt != Kstring && opt != Kzstr, 1,
17271727
"variable-length format");
17281728
size += ntoalign; /* total space used by option */
1729-
luaL_argcheck(L, totalsize <= LUA_MAXINTEGER - size,
1729+
luaL_argcheck(L, totalsize <= MAX_SIZE - size,
17301730
1, "format result too large");
17311731
totalsize += size;
17321732
}

0 commit comments

Comments
 (0)