new definition for 'luaD_checkstack' to avoid possible overflows

This commit is contained in:
Roberto Ierusalimschy
2009-07-08 13:06:51 -03:00
parent aabe3ddbf4
commit abb85fc059

5
ldo.h
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: ldo.h,v 2.12 2009/04/17 14:28:06 roberto Exp roberto $ ** $Id: ldo.h,v 2.13 2009/06/08 19:35:59 roberto Exp roberto $
** Stack and Call structure of Lua ** Stack and Call structure of Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -13,8 +13,7 @@
#include "lzio.h" #include "lzio.h"
#define luaD_checkstack(L,n) \ #define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \
if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
luaD_growstack(L, n); else condmovestack(L); luaD_growstack(L, n); else condmovestack(L);