ligurio/lua-c-api-tests

Assert is triggered in luaL_addgsub_test: Assertion `((B)->b != (B)->init.b) ? lua_touserdata(B->L, boxidx) != ((void*)0) : lua_touserdata(B->L, boxidx) == (void*)B' failed.

Closed this issue · 2 comments

INFO: seed corpus: files: 594 min: 1b max: 2336b total: 146060b rss: 27Mb
luaL_addgsub_test: lauxlib.c:548: char *prepbuffsize(luaL_Buffer *, size_t, int): Assertion `((B)->b != (B)->init.b) ? lua_touserdata(B->L, boxidx) != ((void*)0) : lua_touserdata(B->L, boxidx) == (void*)B' failed.
==3586== ERROR: libFuzzer: deadly signal

GH Actions logs: https://github.com/ligurio/lua-c-api-tests/actions/runs/4977823137/jobs/8907335034

Assertion triggered when CFLAGS -DLUAI_ASSERT=1 -DLUA_USE_APICHECK=1 are enabled.
According to description for luaL_Buffer 1 there are two ways of using Buffer. First one works fine, second one failed with assertion.

Footnotes

  1. https://www.lua.org/manual/5.4/manual.html#luaL_Buffer