lua-users home
lua-l archive

Re: A crash bug in v5.1.4

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


mark@ppl-pilot.com wrote:
> I've tracked down the cause of this bug and created a patch to fix it, you
> can find it at the end of my article on accessors:
Shorter/better patch attached.
--Mike
--- lua-5.1.4/src/lvm.c	2007年12月28日 16:32:23 +0100
+++ lua-5.1.4-settable/src/lvm.c	2009年06月27日 10:27:31 +0200
@@ -132,6 +132,7 @@
 
 
 void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
+ TValue tmp;
 int loop;
 for (loop = 0; loop < MAXTAGLOOP; loop++) {
 const TValue *tm;
@@ -152,7 +153,8 @@
 callTM(L, tm, t, key, val);
 return;
 }
- t = tm; /* else repeat with `tm' */ 
+ setobj(L, &tmp, tm);
+ t = &tmp; /* else repeat with copy of `tm' */ 
 }
 luaG_runerror(L, "loop in settable");
 }

AltStyle によって変換されたページ (->オリジナル) /