lua-users home
lua-l archive

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


Hi,

Taj Khattra wrote:
>
> Segmentation fault (core dumped)

It's a bug in luaL_argerror (doesn't check result of lua_getstack)[1].

But anyway:

>         newL = lua_newthread(L, 0);
>         luaL_check_rawtype(L, 1, LUA_TFUNCTION);
>         ref = luaL_ref(L, LUA_REGISTRYINDEX);
>         lua_rawgeti(newL, LUA_REGISTRYINDEX, ref);
>         luaL_unref(L, LUA_REGISTRYINDEX, ref);
>         lua_call(newL, 0, 1);
>         code = luaL_check_int(newL, 1);
>         lua_close(newL);

the error occured in luaL_check_int(newL, 1).  Note, if there wouldn't
be this segault, the program would have terminated anyway because
there's noone to return to in case of an error.  The error is raised
in newL where no "catcher" has been set.

Ciao, ET.

[1] Or should lua_getstack fill ar for level 0?

PS: luaL_check_int is meant for arguments, not results.