Ver Fonte

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.
Roberto I há 3 semanas atrás
pai
commit
45c7ae5b1b
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      lstrlib.c

+ 1 - 1
lstrlib.c

@@ -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;
   }