lua-users home
lua-l archive

LuaRC reallocstack issue

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


Hello, 
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 i_o2->value. 
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.
Thanks,
Drew Powers 

AltStyle によって変換されたページ (->オリジナル) /