lua-users home
lua-l archive

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


On Wed, Nov 16, 2022 at 8:13 PM Sean Conner <sean@conman.org> wrote:

>   Perhaps I'm unwise in following "play stupid games, win stupid prizes"
> (i.e. trusting a programmer to not nil out __gc metamethods) but I really
> have to wonder how much of an issue this really is.  Do you have actual code
> this breaks?  Or is this more of a "hypothetical, someone might, possibly,
> break some code I wrote" type of issue?  (and am I asking for trouble for
> asking for an actual example?  Am I stupid for not thinking this is an
> issue?  Should every Lua module written in C do the same as Lua's io
> library?)

I found it surprising, in the old discussion, and, apparently, in the
ensuing discussion, how something obviously wrong was being declared
no big deal or even desirable. The programmer obviously did not desire
the removal of the __gc method from his userdata, but, sure, let's
find a fringe case when the circumstances that make that possible
might be useful for something else and leave the whole thing insecure.
Let somebody else figure out how a C library can be made secure.

Lua's publicly stated philosophy, which I quoted previously in
http://lua-users.org/lists/lua-l/2019-06/msg00596.html:

"Such behavior is unacceptable for any Lua library. No matter how we
use a library, it should neither corrupt C data nor cause the Lua
system to crash".

Cheers,
V.