From abb85fc059a5d6427b9dc36edee1619f2c7a1da8 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 8 Jul 2009 13:06:51 -0300 Subject: new definition for 'luaD_checkstack' to avoid possible overflows --- ldo.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ldo.h') diff --git a/ldo.h b/ldo.h index 3e0d50a8..6cd9fdca 100644 --- a/ldo.h +++ b/ldo.h @@ -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 ** See Copyright Notice in lua.h */ @@ -13,9 +13,8 @@ #include "lzio.h" -#define luaD_checkstack(L,n) \ - if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ - luaD_growstack(L, n); else condmovestack(L); +#define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \ + luaD_growstack(L, n); else condmovestack(L); #define incr_top(L) {L->top++; luaD_checkstack(L,0);} -- cgit v1.2.3-55-g6feb