From cd4de92762434e6ed0e6c207d56d365300396dd8 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 16 Jul 2024 11:33:30 -0300 Subject: Maximum stack size may not fit in unsigned short Therefore, fields ftransfer/ntransfer in lua_Debug must have type 'int'. (Maximum stack size must fit in an 'int'.) Also, this commit adds check that maximum stack size respects size_t for size in bytes. --- luaconf.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'luaconf.h') diff --git a/luaconf.h b/luaconf.h index 65715c8b..80349acc 100644 --- a/luaconf.h +++ b/luaconf.h @@ -750,13 +750,13 @@ @@ LUAI_MAXSTACK limits the size of the Lua stack. ** CHANGE it if you need a different limit. This limit is arbitrary; ** its only purpose is to stop Lua from consuming unlimited stack -** space (and to reserve some numbers for pseudo-indices). -** (It must fit into max(size_t)/32 and max(int)/2.) +** space and to reserve some numbers for pseudo-indices. +** (It must fit into max(int)/2.) */ -#if LUAI_IS32INT +#if 1000000 < (INT_MAX / 2) #define LUAI_MAXSTACK 1000000 #else -#define LUAI_MAXSTACK 15000 +#define LUAI_MAXSTACK (INT_MAX / 2u) #endif -- cgit v1.2.3-55-g6feb