[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using file metatable, cause segfault
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 24 Mar 2008 09:00:21 -0300
> > mt = getmetatable(io.stdin)
> > p = newproxy()
> > debug.setmetatable(p, mt)
> > p:read()
> Segmentation fault (core dumped)
>
> I don't really feel it's a bug as someone with access to the debug
> interface should be responsible and not do things this stupid, but I
> thought I'd throw this out there...
That's exactly why Lua does not normally allow setmetatable for userdata:
it breaks C data safety.
The debug library is just for that, debugging. If you expose it to your app,
then anything goes, including segmentation faults, which are usually a very
big no-no for embedded languages.
--lhf