aboutsummaryrefslogtreecommitdiff
path: root/ltable.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-07-18 16:18:30 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-07-18 16:18:30 -0300
commit303f4155593721dfd57dadc6e56122e465ce9efb (patch)
tree2b723c2d744a53f96b0f067e5a39a15a7f9259ad /ltable.h
parentccb8b307f11c7497e61f617b12f3a7f0a697256c (diff)
downloadlua-303f4155593721dfd57dadc6e56122e465ce9efb.tar.gz
lua-303f4155593721dfd57dadc6e56122e465ce9efb.tar.bz2
lua-303f4155593721dfd57dadc6e56122e465ce9efb.zip
Randomness added to table length computation
A bad actor could fill only a few entries in a table (power of twos in decreasing order, see tests) and produce a small table with a huge length. If your program builds a table with external data and iterates over its length, this behavior could be an issue.
Diffstat (limited to 'ltable.h')
-rw-r--r--ltable.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ltable.h b/ltable.h
index ca21e692..f3b7bc7e 100644
--- a/ltable.h
+++ b/ltable.h
@@ -173,7 +173,7 @@ LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned nasize);
173LUAI_FUNC lu_mem luaH_size (Table *t); 173LUAI_FUNC lu_mem luaH_size (Table *t);
174LUAI_FUNC void luaH_free (lua_State *L, Table *t); 174LUAI_FUNC void luaH_free (lua_State *L, Table *t);
175LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 175LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
176LUAI_FUNC lua_Unsigned luaH_getn (Table *t); 176LUAI_FUNC lua_Unsigned luaH_getn (lua_State *L, Table *t);
177 177
178 178
179#if defined(LUA_DEBUG) 179#if defined(LUA_DEBUG)