aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lstate.c b/lstate.c
index f5579a66..463a47d2 100644
--- a/lstate.c
+++ b/lstate.c
@@ -100,13 +100,13 @@ void luaE_setdebt (global_State *g, l_mem debt) {
100** Increment count of "C calls" and check for overflows. In case of 100** Increment count of "C calls" and check for overflows. In case of
101** a stack overflow, check appropriate error ("regular" overflow or 101** a stack overflow, check appropriate error ("regular" overflow or
102** overflow while handling stack overflow). 102** overflow while handling stack overflow).
103** If 'nCcalls' is larger than LUAI_MAXCCALLS but smaller than 103** If 'nCcalls' is larger than LUAI_MAXCSTACK but smaller than
104** LUAI_MAXCCALLS + CSTACKCF (plus 2 to avoid by-one errors), it means 104** LUAI_MAXCSTACK + CSTACKCF (plus 2 to avoid by-one errors), it means
105** it has just entered the "overflow zone", so the function raises an 105** it has just entered the "overflow zone", so the function raises an
106** overflow error. 106** overflow error.
107** If 'nCcalls' is larger than LUAI_MAXCCALLS + CSTACKCF + 2 107** If 'nCcalls' is larger than LUAI_MAXCSTACK + CSTACKCF + 2
108** (which means it is already handling an overflow) but smaller than 108** (which means it is already handling an overflow) but smaller than
109** 9/8 of LUAI_MAXCCALLS, does not report an error (to allow message 109** 9/8 of LUAI_MAXCSTACK, does not report an error (to allow message
110** handling to work). 110** handling to work).
111** Otherwise, report a stack overflow while handling a stack overflow 111** Otherwise, report a stack overflow while handling a stack overflow
112** (probably caused by a repeating error in the message handling 112** (probably caused by a repeating error in the message handling
@@ -115,16 +115,16 @@ void luaE_setdebt (global_State *g, l_mem debt) {
115void luaE_enterCcall (lua_State *L) { 115void luaE_enterCcall (lua_State *L) {
116 int ncalls = getCcalls(L); 116 int ncalls = getCcalls(L);
117 L->nCcalls++; 117 L->nCcalls++;
118 if (ncalls >= LUAI_MAXCCALLS) { /* possible overflow? */ 118 if (ncalls >= LUAI_MAXCSTACK) { /* possible overflow? */
119 luaE_freeCI(L); /* release unused CIs */ 119 luaE_freeCI(L); /* release unused CIs */
120 ncalls = getCcalls(L); /* update call count */ 120 ncalls = getCcalls(L); /* update call count */
121 if (ncalls >= LUAI_MAXCCALLS) { /* still overflow? */ 121 if (ncalls >= LUAI_MAXCSTACK) { /* still overflow? */
122 if (ncalls <= LUAI_MAXCCALLS + CSTACKCF + 2) { 122 if (ncalls <= LUAI_MAXCSTACK + CSTACKCF + 2) {
123 /* no error before increments; raise the error now */ 123 /* no error before increments; raise the error now */
124 L->nCcalls += (CSTACKCF + 4); /* avoid raising it again */ 124 L->nCcalls += (CSTACKCF + 4); /* avoid raising it again */
125 luaG_runerror(L, "C stack overflow"); 125 luaG_runerror(L, "C stack overflow");
126 } 126 }
127 else if (ncalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS >> 3))) 127 else if (ncalls >= (LUAI_MAXCSTACK + (LUAI_MAXCSTACK >> 3)))
128 luaD_throw(L, LUA_ERRERR); /* error while handling stack error */ 128 luaD_throw(L, LUA_ERRERR); /* error while handling stack error */
129 } 129 }
130 } 130 }