aboutsummaryrefslogtreecommitdiff
path: root/luaconf.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-16 11:33:30 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-16 11:33:30 -0300
commitcd4de92762434e6ed0e6c207d56d365300396dd8 (patch)
tree9bc91eb85506b89d7cba0b859e2defce86aed7fc /luaconf.h
parent6b45ccf4ed24dcfe437cf0159d6185119a2e8f95 (diff)
downloadlua-cd4de92762434e6ed0e6c207d56d365300396dd8.tar.gz
lua-cd4de92762434e6ed0e6c207d56d365300396dd8.tar.bz2
lua-cd4de92762434e6ed0e6c207d56d365300396dd8.zip
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.
Diffstat (limited to 'luaconf.h')
-rw-r--r--luaconf.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/luaconf.h b/luaconf.h
index 65715c8b..80349acc 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -750,13 +750,13 @@
750@@ LUAI_MAXSTACK limits the size of the Lua stack. 750@@ LUAI_MAXSTACK limits the size of the Lua stack.
751** CHANGE it if you need a different limit. This limit is arbitrary; 751** CHANGE it if you need a different limit. This limit is arbitrary;
752** its only purpose is to stop Lua from consuming unlimited stack 752** its only purpose is to stop Lua from consuming unlimited stack
753** space (and to reserve some numbers for pseudo-indices). 753** space and to reserve some numbers for pseudo-indices.
754** (It must fit into max(size_t)/32 and max(int)/2.) 754** (It must fit into max(int)/2.)
755*/ 755*/
756#if LUAI_IS32INT 756#if 1000000 < (INT_MAX / 2)
757#define LUAI_MAXSTACK 1000000 757#define LUAI_MAXSTACK 1000000
758#else 758#else
759#define LUAI_MAXSTACK 15000 759#define LUAI_MAXSTACK (INT_MAX / 2u)
760#endif 760#endif
761 761
762 762