lua-users home
lua-l archive

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


It was thus said that the Great Coroutines once stated:
> On Sat, Aug 23, 2014 at 4:28 AM, Jay Carlson <nop@nop.com> wrote:
> 
> > Yes. It is also a relatively common error to reuse bufs/pool members before
> > all references to them have dropped.
> 
> This is one of those "I know better than you -- we should avoid the
> potential for users to screw themselves." retorts.
> 
> Why do you care if I shoot my foot?  It's not yours :p

  Reusing a buffer was the cause of the recent Heartbleed bug that affected
OpenSSL and just about everything that relied upon it.

  You want to shoot your own foot off?  Have at it.  But hopefully shooting
off your foot won't lead to much collateral damage.

> > Any userdata? Or just a specific mutable octet vector type?
> 
> I would like the option of peering into and modifying any userdata
> from Lua as if it were a string, with the string functions.  This
> would break security so I'd want to control this ability through the
> debug library.

  Okay, so you can interate over the actual bytes that make up a userdata. 
Fine.  But what, exactly, are you attempting to do, other than "because I
can"?  

  Fine, let's say you can magically do this:

	x = io.stdout:sub(1,4)

  What do you have?  On a 32-bit system, you have the raw FILE * that you
really can't do anything with from Lua, and modifying the raw bytes of the
userdata would cause problems.  There is no facility to follow such a
pointer from Lua, and even if there were, again, what's the point?  You have
to know the structure layout at such a low level that any code you write is
not really portable in any meaningful sense.  And on a 64-bit system, you
have half a FILE * pointer, but unless you know the platform, you can't know
if it's the upper half (big endian system) or lower half (little endian
system).

  The issue I have with this (and I can't speak for others) is that it
doesn't really *buy* you anthying but pointless complexity.

  -spc