commit b3b7cf7335048afa1fce4033a565b55ad5d079c2
parent 8622dc18bfa9da14136763e9538222fdec31a79a
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 27 Jan 1998 17:13:24 -0200
BUG: "lua_getstring" may create a new string, so should check GC
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git 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
@@ -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)