[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Meta function tables for LUA_FILEHANDLE: why two separate tables?
- From: Viacheslav Usov <via.usov@...>
- Date: Thu, 17 Nov 2022 18:54:39 +0100
On Wed, Nov 16, 2022 at 8:13 PM Sean Conner <email@example.com> 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
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
"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".