summaryrefslogtreecommitdiff
path: root/luaconf.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-07-15 14:26:14 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-07-15 14:26:14 -0300
commitf76f4cb79d84af4a7be9e0d75553bbe05a3ae90c (patch)
treedd9d1f8f3fb8c69f7617fe5688d7b1178bb7190e /luaconf.h
parentabb85fc059a5d6427b9dc36edee1619f2c7a1da8 (diff)
downloadlua-f76f4cb79d84af4a7be9e0d75553bbe05a3ae90c.tar.gz
lua-f76f4cb79d84af4a7be9e0d75553bbe05a3ae90c.tar.bz2
lua-f76f4cb79d84af4a7be9e0d75553bbe05a3ae90c.zip
new way to control stack overflow, controling only total size of the stack
Diffstat (limited to 'luaconf.h')
-rw-r--r--luaconf.h30
1 files changed, 9 insertions, 21 deletions
diff --git a/luaconf.h b/luaconf.h
index 96dacdda..d8bcc2ba 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.105 2009/06/18 18:19:36 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.106 2009/07/01 16:16:40 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -417,31 +417,19 @@
417 417
418 418
419/* 419/*
420@@ LUAI_MAXCALLS limits the number of nested calls. 420@@ LUAI_MAXSTACK limits the size of the Lua stack.
421** CHANGE it if you need really deep recursive calls. This limit is
422** arbitrary; its only purpose is to stop infinite recursion before
423** exhausting memory.
424*/
425#define LUAI_MAXCALLS 20000
426
427
428/*
429@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function
430@* can use.
431** CHANGE it if you need a different limit. This limit is arbitrary; 421** CHANGE it if you need a different limit. This limit is arbitrary;
432** its only purpose is to stop C functions to consume unlimited stack 422** its only purpose is to stop Lua to consume unlimited stack
433** space. 423** space (and to reserve some numbers for pseudo-indices).
434*/ 424*/
435/* life is simpler if stack size fits in an int (16 is an estimate 425#if LUAI_BITSINT >= 32
436 for the size of a Lua value) */ 426#define LUAI_MAXSTACK 1000000
437#if SHRT_MAX < (INT_MAX / 16)
438#define LUAI_MCS_AUX SHRT_MAX
439#else 427#else
440#define LUAI_MCS_AUX (INT_MAX / 16) 428#define LUAI_MAXSTACK 15000
441#endif 429#endif
442 430
443/* reserve some space for pseudo-indices */ 431/* reserve some space for error handling */
444#define LUAI_MAXCSTACK (LUAI_MCS_AUX - 1000) 432#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000)
445 433
446 434
447 435