summaryrefslogtreecommitdiff
path: root/ldo.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-07-08 13:06:51 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-07-08 13:06:51 -0300
commitabb85fc059a5d6427b9dc36edee1619f2c7a1da8 (patch)
tree0fd1add469b7e2f36e04bc634ffe21bf30dfc84e /ldo.h
parentaabe3ddbf4514b6c80258e731fbe90e74edcdc94 (diff)
downloadlua-abb85fc059a5d6427b9dc36edee1619f2c7a1da8.tar.gz
lua-abb85fc059a5d6427b9dc36edee1619f2c7a1da8.tar.bz2
lua-abb85fc059a5d6427b9dc36edee1619f2c7a1da8.zip
new definition for 'luaD_checkstack' to avoid possible overflows
Diffstat (limited to 'ldo.h')
-rw-r--r--ldo.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/ldo.h b/ldo.h
index 3e0d50a8..6cd9fdca 100644
--- a/ldo.h
+++ b/ldo.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.h,v 2.12 2009/04/17 14:28:06 roberto Exp roberto $ 2** $Id: ldo.h,v 2.13 2009/06/08 19:35:59 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -13,9 +13,8 @@
13#include "lzio.h" 13#include "lzio.h"
14 14
15 15
16#define luaD_checkstack(L,n) \ 16#define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \
17 if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ 17 luaD_growstack(L, n); else condmovestack(L);
18 luaD_growstack(L, n); else condmovestack(L);
19 18
20 19
21#define incr_top(L) {L->top++; luaD_checkstack(L,0);} 20#define incr_top(L) {L->top++; luaD_checkstack(L,0);}