Commit Diff


commit - b19e7881b33343877530df6b4df095ef3d206e82
commit + e5964c4085fcf116eb56d4bad1ca8168aab4be2e
blob - 63a2f19f81ff9640a55ea0d36c6049cea8816f36
blob + da7e56be7ec30f8fe18179910cd5a9062f715ad5
--- tests/capi/luaL_loadbufferx_test.c
+++ tests/capi/luaL_loadbufferx_test.c
@@ -29,10 +29,20 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t siz
 	 * (that is, a precompiled chunk). It may be the string "b" (only binary
 	 * chunks), "t" (only text chunks), or "bt" (both binary and text). The
 	 * default is "bt".
-	 * Seed corpus is shared by different Lua runtimes (PUC Rio Lua and LuaJIT),
-	 * enabling binary mode could lead false positive crashes in LuaJIT.
+	 * Lua runtime (at least PUC Rio Lua and LuaJIT) has bytecode and Lua
+	 * parsers. It is desired to test both parsers, however, in LuaJIT
+	 * bytecode parser failed with assertion:
+	 *
+	 * LuaJIT ASSERT lj_bcread.c:123: bcread_byte: buffer read overflow
+	 *
+	 * so in LuaJIT only text mode is used and therefore only text parser is
+	 * tested.
 	 */
+#ifdef LUAJIT
 	const char *mode = "t";
+#else
+	const char *mode = "bt";
+#endif /* LUAJIT */
 	luaL_loadbufferx(L, (const char *)data, size, "fuzz", mode);
 
 	lua_settop(L, 0);