lua-users home
lua-l archive

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


On Sun, Apr 27, 2014 at 08:09:10AM +0200, Karel Tuma wrote:
> Hello,
> 
> Just stumbled on this again (and thus have to run modified Lua),
> so I guess it's worth it to generalize this into a polyfill for portability.
> 
> https://github.com/katlogic/pudata
> 
> Sometimes, one needs to push existing userdata by pointer. This is not
> safe (as the pointer might be stale), therefore it is not part of core
> Lua api.

I don't understand what the issue is. Can you describe it in more detail?
Why would you push a stale pointer? A pointer is completely and utterly
invalid after it's been freed, so even copying its value is invalid, as well
as dereferencing it.