summaryrefslogtreecommitdiff
path: root/bugs
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-07-01 18:10:33 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-07-01 18:10:33 -0300
commitd57c9cdefc6f00d8bf8bb24b96e65631a1c3ef18 (patch)
treeb209ba420259badad879f706686c493a83ae7b61 /bugs
parentafb3f7e754bde70895d639ff2a2738409a51c60e (diff)
downloadlua-d57c9cdefc6f00d8bf8bb24b96e65631a1c3ef18.tar.gz
lua-d57c9cdefc6f00d8bf8bb24b96e65631a1c3ef18.tar.bz2
lua-d57c9cdefc6f00d8bf8bb24b96e65631a1c3ef18.zip
BUG: 'luaV_settable' may invalidate a reference to a table and try
to reuse it.
Diffstat (limited to 'bugs')
-rw-r--r--bugs51
1 files changed, 46 insertions, 5 deletions
diff --git a/bugs b/bugs
index a85e40cb..3b45c0c2 100644
--- a/bugs
+++ b/bugs
@@ -1880,8 +1880,8 @@ patch = [[
1880+++ lundump.c 2008/04/04 19:51:41 2.7.1.4 1880+++ lundump.c 2008/04/04 19:51:41 2.7.1.4
1881@@ -1,5 +1,5 @@ 1881@@ -1,5 +1,5 @@
1882 /* 1882 /*
1883-** $Id: bugs,v 1.99 2009/04/27 20:11:11 roberto Exp roberto $ 1883-** $Id: bugs,v 1.100 2009/06/15 14:12:59 roberto Exp roberto $
1884+** $Id: bugs,v 1.99 2009/04/27 20:11:11 roberto Exp roberto $ 1884+** $Id: bugs,v 1.100 2009/06/15 14:12:59 roberto Exp roberto $
1885 ** load precompiled Lua chunks 1885 ** load precompiled Lua chunks
1886 ** See Copyright Notice in lua.h 1886 ** See Copyright Notice in lua.h
1887 */ 1887 */
@@ -2060,7 +2060,7 @@ patch = [[
2060 2060
2061Bug{ 2061Bug{
2062what = [[internal macro 'svalue' is wrong]], 2062what = [[internal macro 'svalue' is wrong]],
2063report = [["Martijn van Buul, on 2008/08/04]], 2063report = [[Martijn van Buul, on 2008/08/04]],
2064since = [[5.1]], 2064since = [[5.1]],
2065example = [[ 2065example = [[
2066/* in luaconf.h */ 2066/* in luaconf.h */
@@ -2083,7 +2083,7 @@ patch = [[
2083 2083
2084Bug{ 2084Bug{
2085what = [[malicious zero-length string in binary code may segfault Lua]], 2085what = [[malicious zero-length string in binary code may segfault Lua]],
2086report = [["Peter Cawley, on 2008/09/01]], 2086report = [[Peter Cawley, on 2008/09/01]],
2087since = [[5.1]], 2087since = [[5.1]],
2088example = [[ 2088example = [[
2089loadstring(('').dump(function()X''end):gsub('\2%z%z%zX','\0\0\0'))() 2089loadstring(('').dump(function()X''end):gsub('\2%z%z%zX','\0\0\0'))()
@@ -2095,7 +2095,7 @@ patch = [[
2095 2095
2096Bug{ 2096Bug{
2097what = [[wrong code generation for some particular boolean expressions]], 2097what = [[wrong code generation for some particular boolean expressions]],
2098report = [["Brian Kelley, on 2009/04/15]], 2098report = [[Brian Kelley, on 2009/04/15]],
2099since = [[5.0]], 2099since = [[5.0]],
2100example = [[ 2100example = [[
2101print(((1 or false) and true) or false) --> 1 2101print(((1 or false) and true) or false) --> 1
@@ -2152,3 +2152,44 @@ patch = [[
2152]], 2152]],
2153} 2153}
2154 2154
2155Bug{
2156what = [['luaV_settable' may invalidate a reference to a table and try
2157to reuse it]],
2158report = [[Mark Feldman, on 2009/06/27]],
2159since = [[5.0]],
2160example = [[
2161grandparent = {}
2162grandparent.__newindex = function(s,_,_) print(s) end
2163
2164parent = {}
2165parent.__newindex = parent
2166setmetatable(parent, grandparent)
2167
2168child = setmetatable({}, parent)
2169child.foo = 10 --> (crash on some machines)
2170]],
2171patch = [[
2172--- lvm.c 2007/12/28 15:32:23 2.63.1.3
2173+++ lvm.c 2009/07/01 20:36:59
2174@@ -133,6 +133,7 @@
2175
2176 void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
2177 int loop;
2178+ TValue temp;
2179 for (loop = 0; loop < MAXTAGLOOP; loop++) {
2180 const TValue *tm;
2181 if (ttistable(t)) { /* `t' is a table? */
2182@@ -152,7 +153,9 @@
2183 callTM(L, tm, t, key, val);
2184 return;
2185 }
2186- t = tm; /* else repeat with `tm' */
2187+ /* else repeat with `tm' */
2188+ setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */
2189+ t = &temp;
2190 }
2191 luaG_runerror(L, "loop in settable");
2192 }
2193]],
2194}
2195