[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Interesting stack overflow in Lua 5.3
- From: Sean Conner <sean@...>
- Date: Thu, 3 Sep 2015 14:12:24 -0400
It was thus said that the Great Roberto Ierusalimschy once stated:
> > The following function, when invoked, causes a C stack overflow
> > in Lua 5.3.
> >
> > local subsystem_mt = {__index =
> > function(spec,auction)
> > for key,bid in ipairs(spec) do
> > print("Checking '"..auction.."' against '"..key.."'")
> > end
> > end}
>
> I may be missing something, but "The following function" does not seem
> to be a function. It looks like a table... (Therefore, I do not know
> how to invoke it to cause something.)
All I did was take that code, then add
x = setmetatable({},subsystem_mt)
print(x.one)
Under Lua 5.1, I got:
nil
Under Lua 5.3, I got:
lua-53: y.lua:5: C stack overflow
stack traceback:
y.lua:5: in function <y.lua:4>
[C]: in for iterator 'for iterator'
y.lua:5: in function <y.lua:4>
[C]: in for iterator 'for iterator'
y.lua:5: in function <y.lua:4>
[C]: in for iterator 'for iterator'
y.lua:5: in function <y.lua:4>
[C]: in for iterator 'for iterator'
y.lua:5: in function <y.lua:4>
[C]: in for iterator 'for iterator'
...
y.lua:5: in function <y.lua:4>
[C]: in for iterator 'for iterator'
y.lua:5: in function <y.lua:4>
[C]: in for iterator 'for iterator'
y.lua:5: in function <y.lua:4>
[C]: in for iterator 'for iterator'
y.lua:5: in function <y.lua:4>
[C]: in for iterator 'for iterator'
y.lua:5: in metamethod '__index'
y.lua:11: in main chunk
[C]: in ?
-spc (seems pretty straightforward to me ... )