From 98296f6b45208e32a83dcb582b3a37b406289d85 Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 24 Aug 2005 13:15:49 -0300
Subject: some bugs related to stack reallocation

---
 lapi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'lapi.c')

diff --git a/lapi.c b/lapi.c
index 6efdb505..65812d78 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lapi.c,v 2.45 2005/07/06 18:07:30 roberto Exp roberto $
+** $Id: lapi.c,v 2.46 2005/07/31 17:12:32 roberto Exp roberto $
 ** Lua API
 ** See Copyright Notice in lua.h
 */
@@ -344,6 +344,7 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
       return NULL;
     }
     luaC_checkGC(L);
+    o = index2adr(L, idx);  /* previous call may reallocate the stack */
     lua_unlock(L);
   }
   if (len != NULL) *len = tsvalue(o)->len;
-- 
cgit v1.2.3-55-g6feb