blob: 63bc56e81f81aa92411aedd4d46b774ea1e7543f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
diff -rdu lua-5.1.3.orig/src/lapi.c lua-5.1.3/src/lapi.c
--- lua-5.1.3.orig/src/lapi.c 2008-02-12 16:17:59.000000000 +0000
+++ lua-5.1.3/src/lapi.c 2008-02-12 16:26:32.000000000 +0000
@@ -93,15 +93,14 @@
LUA_API int lua_checkstack (lua_State *L, int size) {
- int res;
+ int res = 1;
lua_lock(L);
- if ((L->top - L->base + size) > LUAI_MAXCSTACK)
+ if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK)
res = 0; /* stack overflow */
- else {
+ else if (size > 0) {
luaD_checkstack(L, size);
if (L->ci->top < L->top + size)
L->ci->top = L->top + size;
- res = 1;
}
lua_unlock(L);
return res;
|