mirror of
https://github.com/lua/lua.git
synced 2026-06-08 08:03:49 +00:00
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.
This commit is contained in:
@@ -1726,7 +1726,7 @@ static int str_packsize (lua_State *L) {
|
||||
luaL_argcheck(L, opt != Kstring && opt != Kzstr, 1,
|
||||
"variable-length format");
|
||||
size += ntoalign; /* total space used by option */
|
||||
luaL_argcheck(L, totalsize <= LUA_MAXINTEGER - size,
|
||||
luaL_argcheck(L, totalsize <= MAX_SIZE - size,
|
||||
1, "format result too large");
|
||||
totalsize += size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user