Compare commits

...

2 Commits

Author SHA1 Message Date
Mike Pall
e76bb50d44 Fix error generation in load*.
Reported by Sergey Kaplun. #1353
2025-04-07 10:27:40 +02:00
Mike Pall
e9e4b6d302 Initialize unused value when specializing to cdata metatable.
Reported by jakitliang. #1354
2025-04-07 09:22:07 +02:00
2 changed files with 6 additions and 2 deletions

View File

@ -108,8 +108,9 @@ LUALIB_API int luaL_loadfilex(lua_State *L, const char *filename,
copyTV(L, L->top-1, L->top);
}
if (err) {
const char *fname = filename ? filename : "stdin";
L->top--;
lua_pushfstring(L, "cannot read %s: %s", chunkname+1, strerror(err));
lua_pushfstring(L, "cannot read %s: %s", fname, strerror(err));
return LUA_ERRFILE;
}
return status;

View File

@ -854,7 +854,10 @@ int lj_record_mm_lookup(jit_State *J, RecordIndex *ix, MMS mm)
return 0; /* No metamethod. */
}
/* The cdata metatable is treated as immutable. */
if (LJ_HASFFI && tref_iscdata(ix->tab)) goto immutable_mt;
if (LJ_HASFFI && tref_iscdata(ix->tab)) {
mix.tab = TREF_NIL;
goto immutable_mt;
}
ix->mt = mix.tab = lj_ir_ktab(J, mt);
goto nocheck;
}