The vendored Lua 5.4 core is clean (allocator NULL handled everywhere via LUA_ERRMEM), but the hand-written MVS glue in src/loslib.c allocates buffers sized by the script's string lengths and dereferences them immediately:
src/loslib.c:580,581,582 — os_bitand buf1/buf2/resp, memcpy into them two lines later
src/loslib.c:623,624,625 — os_bitor, same shape
src/loslib.c:666,667,668 — os_bitxor, same shape
src/loslib.c:706 — os_x2c, writes resp[j++] at :719
Since libc370#81 (fixed by libc370#82, in the sysroot as of 2026-08-09) malloc() returns NULL on shortage, so each of these is an S0C4 — in the lua370 CLI, or inside httpd when the same code runs under httplua.
Fix: allocate through Lua's own luaM_/luaL_Buffer machinery (which raises LUA_ERRMEM properly) or check and luaL_error — the sizes are attacker/script-controlled, so the failure must land in the script's error handling, not in the host process.
Sweep context: mvslovers/libc370#81 (comment)
The vendored Lua 5.4 core is clean (allocator NULL handled everywhere via
LUA_ERRMEM), but the hand-written MVS glue insrc/loslib.callocates buffers sized by the script's string lengths and dereferences them immediately:src/loslib.c:580,581,582—os_bitandbuf1/buf2/resp,memcpyinto them two lines latersrc/loslib.c:623,624,625—os_bitor, same shapesrc/loslib.c:666,667,668—os_bitxor, same shapesrc/loslib.c:706—os_x2c, writesresp[j++]at:719Since libc370#81 (fixed by libc370#82, in the sysroot as of 2026-08-09)
malloc()returns NULL on shortage, so each of these is an S0C4 — in the lua370 CLI, or inside httpd when the same code runs under httplua.Fix: allocate through Lua's own
luaM_/luaL_Buffermachinery (which raisesLUA_ERRMEMproperly) or check andluaL_error— the sizes are attacker/script-controlled, so the failure must land in the script's error handling, not in the host process.Sweep context: mvslovers/libc370#81 (comment)