aboutsummaryrefslogtreecommitdiff
path: root/lstate.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-02-26 11:31:10 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-02-26 11:31:10 -0300
commitf9e35627ed26dff4114a1d01ff113d8b4cc91ab5 (patch)
treead817f574adcd2d57720c8a498626919b85e6e78 /lstate.h
parentceac82f78be8baeddfa8536472d8b08df2eb7d49 (diff)
downloadlua-f9e35627ed26dff4114a1d01ff113d8b4cc91ab5.tar.gz
lua-f9e35627ed26dff4114a1d01ff113d8b4cc91ab5.tar.bz2
lua-f9e35627ed26dff4114a1d01ff113d8b4cc91ab5.zip
'lua_State.nci' must be an integer
Lua can easily overflow an unsigned short counting nested calls. (The limit to this value is the maximum stack size, LUAI_MAXSTACK, which is currently 1e6.)
Diffstat (limited to 'lstate.h')
-rw-r--r--lstate.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lstate.h b/lstate.h
index 050fc35f..f841c232 100644
--- a/lstate.h
+++ b/lstate.h
@@ -290,7 +290,6 @@ struct lua_State {
290 CommonHeader; 290 CommonHeader;
291 lu_byte allowhook; 291 lu_byte allowhook;
292 TStatus status; 292 TStatus status;
293 unsigned short nci; /* number of items in 'ci' list */
294 StkIdRel top; /* first free slot in the stack */ 293 StkIdRel top; /* first free slot in the stack */
295 struct global_State *l_G; 294 struct global_State *l_G;
296 CallInfo *ci; /* call info for current function */ 295 CallInfo *ci; /* call info for current function */
@@ -306,6 +305,7 @@ struct lua_State {
306 ptrdiff_t errfunc; /* current error handling function (stack index) */ 305 ptrdiff_t errfunc; /* current error handling function (stack index) */
307 l_uint32 nCcalls; /* number of nested non-yieldable or C calls */ 306 l_uint32 nCcalls; /* number of nested non-yieldable or C calls */
308 int oldpc; /* last pc traced */ 307 int oldpc; /* last pc traced */
308 int nci; /* number of items in 'ci' list */
309 int basehookcount; 309 int basehookcount;
310 int hookcount; 310 int hookcount;
311 volatile l_signalT hookmask; 311 volatile l_signalT hookmask;