From b3b7cf7335048afa1fce4033a565b55ad5d079c2 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 27 Jan 1998 17:13:45 -0200 Subject: [PATCH] BUG: "lua_getstring" may create a new string, so should check GC --- bugs | 5 +++++ lapi.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bugs b/bugs index d2155964..ffa4cec1 100644 --- a/bugs +++ b/bugs @@ -24,3 +24,8 @@ Tue Jan 27 15:27:49 EDT 1998 >> formats like "%020d" were considered too big (3 algarithms); moreover, >> some sistems limit printf to at most 500 chars, so we can limit sizes >> to 2 digits (99). + +** lapi.c +Tue Jan 27 17:12:36 EDT 1998 +>> "lua_getstring" may create a new string, so should check GC + diff --git a/lapi.c b/lapi.c index edce0266..a1e975a3 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 1.18 1998/01/07 16:26:48 roberto Exp roberto $ +** $Id: lapi.c,v 1.19 1998/01/09 14:44:55 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -287,6 +287,7 @@ double lua_getnumber (lua_Object object) char *lua_getstring (lua_Object object) { + luaC_checkGC(); /* "tostring" may create a new string */ if (object == LUA_NOOBJECT || tostring(Address(object))) return NULL; else return (svalue(Address(object))); @@ -341,6 +342,7 @@ void lua_pushCclosure (lua_CFunction fn, int n) fvalue(L->stack.top) = fn; incr_top; luaV_closure(n); + luaC_checkGC(); } void lua_pushusertag (void *u, int tag)