diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-27 17:13:45 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-27 17:13:45 -0200 |
commit | b3b7cf7335048afa1fce4033a565b55ad5d079c2 (patch) | |
tree | 6c191b5cbdded308d5fbbdf7be9765e6f6116eb2 | |
parent | 8622dc18bfa9da14136763e9538222fdec31a79a (diff) | |
download | lua-b3b7cf7335048afa1fce4033a565b55ad5d079c2.tar.gz lua-b3b7cf7335048afa1fce4033a565b55ad5d079c2.tar.bz2 lua-b3b7cf7335048afa1fce4033a565b55ad5d079c2.zip |
BUG: "lua_getstring" may create a new string, so should check GC
-rw-r--r-- | bugs | 5 | ||||
-rw-r--r-- | lapi.c | 4 |
2 files changed, 8 insertions, 1 deletions
@@ -24,3 +24,8 @@ Tue Jan 27 15:27:49 EDT 1998 | |||
24 | >> formats like "%020d" were considered too big (3 algarithms); moreover, | 24 | >> formats like "%020d" were considered too big (3 algarithms); moreover, |
25 | >> some sistems limit printf to at most 500 chars, so we can limit sizes | 25 | >> some sistems limit printf to at most 500 chars, so we can limit sizes |
26 | >> to 2 digits (99). | 26 | >> to 2 digits (99). |
27 | |||
28 | ** lapi.c | ||
29 | Tue Jan 27 17:12:36 EDT 1998 | ||
30 | >> "lua_getstring" may create a new string, so should check GC | ||
31 | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.18 1998/01/07 16:26:48 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.19 1998/01/09 14:44:55 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -287,6 +287,7 @@ double lua_getnumber (lua_Object object) | |||
287 | 287 | ||
288 | char *lua_getstring (lua_Object object) | 288 | char *lua_getstring (lua_Object object) |
289 | { | 289 | { |
290 | luaC_checkGC(); /* "tostring" may create a new string */ | ||
290 | if (object == LUA_NOOBJECT || tostring(Address(object))) | 291 | if (object == LUA_NOOBJECT || tostring(Address(object))) |
291 | return NULL; | 292 | return NULL; |
292 | else return (svalue(Address(object))); | 293 | else return (svalue(Address(object))); |
@@ -341,6 +342,7 @@ void lua_pushCclosure (lua_CFunction fn, int n) | |||
341 | fvalue(L->stack.top) = fn; | 342 | fvalue(L->stack.top) = fn; |
342 | incr_top; | 343 | incr_top; |
343 | luaV_closure(n); | 344 | luaV_closure(n); |
345 | luaC_checkGC(); | ||
344 | } | 346 | } |
345 | 347 | ||
346 | void lua_pushusertag (void *u, int tag) | 348 | void lua_pushusertag (void *u, int tag) |