mirror of
https://github.com/lua/lua
synced 2024-12-26 04:16:52 +03:00
BUG: "lua_getstring" may create a new string, so should check GC
This commit is contained in:
parent
8622dc18bf
commit
b3b7cf7335
5
bugs
5
bugs
@ -24,3 +24,8 @@ Tue Jan 27 15:27:49 EDT 1998
|
|||||||
>> formats like "%020d" were considered too big (3 algarithms); moreover,
|
>> formats like "%020d" were considered too big (3 algarithms); moreover,
|
||||||
>> some sistems limit printf to at most 500 chars, so we can limit sizes
|
>> some sistems limit printf to at most 500 chars, so we can limit sizes
|
||||||
>> to 2 digits (99).
|
>> 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
|
||||||
|
|
||||||
|
4
lapi.c
4
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
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -287,6 +287,7 @@ double lua_getnumber (lua_Object object)
|
|||||||
|
|
||||||
char *lua_getstring (lua_Object object)
|
char *lua_getstring (lua_Object object)
|
||||||
{
|
{
|
||||||
|
luaC_checkGC(); /* "tostring" may create a new string */
|
||||||
if (object == LUA_NOOBJECT || tostring(Address(object)))
|
if (object == LUA_NOOBJECT || tostring(Address(object)))
|
||||||
return NULL;
|
return NULL;
|
||||||
else return (svalue(Address(object)));
|
else return (svalue(Address(object)));
|
||||||
@ -341,6 +342,7 @@ void lua_pushCclosure (lua_CFunction fn, int n)
|
|||||||
fvalue(L->stack.top) = fn;
|
fvalue(L->stack.top) = fn;
|
||||||
incr_top;
|
incr_top;
|
||||||
luaV_closure(n);
|
luaV_closure(n);
|
||||||
|
luaC_checkGC();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_pushusertag (void *u, int tag)
|
void lua_pushusertag (void *u, int tag)
|
||||||
|
Loading…
Reference in New Issue
Block a user