lua-users home
lua-l archive

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


Graham Wakefield wrote:
> Hope this is useful feedback: I've had consistent crashes with a rather 
> large codebase, every time in lua_iscfunction() (sometimes but not always 
> with negative indices).

Thanks for the report! Patch attached.

--Mike
--- a/src/lj_api.c
+++ b/src/lj_api.c
@@ -202,7 +202,7 @@ LUA_API const char *lua_typename(lua_State *L, int t)
 LUA_API int lua_iscfunction(lua_State *L, int idx)
 {
   cTValue *o = index2adr(L, idx);
-  return !isluafunc(funcV(o));
+  return tvisfunc(o) && !isluafunc(funcV(o));
 }
 
 LUA_API int lua_isnumber(lua_State *L, int idx)