lua-users home
lua-l archive

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


The following piece of code causes Lua to crash in luaH_getstr on my 
system (using the Debian Lua packages):

#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

static lua_State *l_st;

int main(void)
{
	l_st=lua_open();
	if(l_st==NULL)
		return 0;
	lua_rawgeti(l_st, LUA_REGISTRYINDEX, LUA_NOREF);
	luaL_getn(l_st, -1);
	lua_close(l_st);
}

(I use LUA_NOREF to pass around empty/unset tables in Ion without caring
to check for it in the higher-level routines.)

GDB backtrace:

#0  0x4003701d in luaH_getstr () from /usr/lib/liblua50.so.5.0
#1  0x400370e7 in luaH_get () from /usr/lib/liblua50.so.5.0
#2  0x40027763 in lua_rawget () from /usr/lib/liblua50.so.5.0
#3  0x40043017 in luaL_getn () from /usr/lib/liblualib50.so.5.0
#4  0x0804855c in main ()
#5  0x40066a51 in __libc_start_main () from /lib/libc.so.6

-- 
Tuomo