lua-users home
lua-l archive

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

I have communicated this to Drew, but this issue has been fixed now and is
checked into Subversion at


-----Original Message-----
[] On Behalf Of Powers, Drew
Sent: Friday, September 17, 2004 3:57 PM
Subject: LuaRC reallocstack issue


I've run into a problem using the latest Subversion get of LuaRC (as of
9/15/04) while using a custom memory handler under MSVC++ 7.1.  The issue
seems to be related to the cleanarray change added to ldo.c
luaD_reallocstack when growing the stack.  The elements within L->top to
L->stack_last are assumed to be initialized in the new memory region,
which realloc does not guarantee.  This causes the (i_o2->tt >=
LUA_TSTRING) test to pass depending on the contents of that uninitialized
memory then crashes in ((--gcvalue(i_o2)->gch.ref)<=0)) dereferencing

Should this not be calling cleanarray and iterating through those new
elements calling setnilvalue2n instead? 

Another minor issue, calling lua_pop(-1) on an empty stack crashes LuaRC in
lua_settop()'s cleanarray.


Drew Powers