diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-17 17:10:17 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-17 17:10:17 -0300 |
commit | 3d80aeab5abb96fb720621a4cb93e1e6f3172499 (patch) | |
tree | 85243fbe4733437706281334ca8ad9122c7dde0c | |
parent | 3811e23b32d3b43426c869c564bb2a8d1575b64e (diff) | |
download | lua-3d80aeab5abb96fb720621a4cb93e1e6f3172499.tar.gz lua-3d80aeab5abb96fb720621a4cb93e1e6f3172499.tar.bz2 lua-3d80aeab5abb96fb720621a4cb93e1e6f3172499.zip |
lua_pushstring may reallocate the stack, making 'o' a dangling
pointer
-rw-r--r-- | ltests.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.106 2010/05/11 20:48:36 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.107 2010/05/14 13:15:54 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -605,19 +605,20 @@ static int get_gccolor (lua_State *L) { | |||
605 | if (!iscollectable(o)) | 605 | if (!iscollectable(o)) |
606 | lua_pushstring(L, "no collectable"); | 606 | lua_pushstring(L, "no collectable"); |
607 | else { | 607 | else { |
608 | int marked = gcvalue(o)->gch.marked; | ||
608 | int n = 1; | 609 | int n = 1; |
609 | lua_pushstring(L, iswhite(gcvalue(o)) ? "white" : | 610 | lua_pushstring(L, iswhite(gcvalue(o)) ? "white" : |
610 | isblack(gcvalue(o)) ? "black" : "grey"); | 611 | isblack(gcvalue(o)) ? "black" : "grey"); |
611 | if (testbit(gcvalue(o)->gch.marked, FINALIZEDBIT)) { | 612 | if (testbit(marked, FINALIZEDBIT)) { |
612 | lua_pushliteral(L, "/finalized"); n++; | 613 | lua_pushliteral(L, "/finalized"); n++; |
613 | } | 614 | } |
614 | if (testbit(gcvalue(o)->gch.marked, SEPARATED)) { | 615 | if (testbit(marked, SEPARATED)) { |
615 | lua_pushliteral(L, "/separated"); n++; | 616 | lua_pushliteral(L, "/separated"); n++; |
616 | } | 617 | } |
617 | if (testbit(gcvalue(o)->gch.marked, FIXEDBIT)) { | 618 | if (testbit(marked, FIXEDBIT)) { |
618 | lua_pushliteral(L, "/fixed"); n++; | 619 | lua_pushliteral(L, "/fixed"); n++; |
619 | } | 620 | } |
620 | if (isold(gcvalue(o))) { | 621 | if (testbit(marked, OLDBIT)) { |
621 | lua_pushliteral(L, "/old"); n++; | 622 | lua_pushliteral(L, "/old"); n++; |
622 | } | 623 | } |
623 | lua_concat(L, n); | 624 | lua_concat(L, n); |