> Hi! We found an assertion failure crash when testing with the fuzzing
> driver luaL_dostring_test
>
> PoC:
> ```
> weak={}
> setmetatable(weak,{})
> for i=0,1000 do
> weak[i]=0
> end
>
> local si0e=#weak
> do e=0
> end
> for i=0,si0e do
> setmetatable(weak,{__mode="kv"})
> do weak[i+si0e]=0
> end
> end
> ```
>
> Backtrace:
> ```
> luaL_dostring_test: lapi.c:817: int lua_getmetatable(lua_State *, int):
> Assertion `0' failed.
> ==2740207== ERROR: libFuzzer: deadly signal
> [...]
>
> Version: 0508724910b252010ae5f6bcaef0e54cf198cf5b 2025-06-02 11:54:30+0300
Many thanks for the feedback. This bug has been lurking in Lua for at
least 10 years...
(Please, try to refer to the Lua repo when reporting errors I almost
dismissed that message, since Lua neither have anything called
luaL_dostring_test nor a commit 0508724910.)
-- Roberto