OAP Lizzard A game interface engine
Game interfaces, outside the game Settings
← The journal
event Stage 1 · Lua from C# Fix

A test host crash traced to Lua's stack

A harmless-looking commit crashed the test host with heap corruption. The real fault was older: C# pushed values onto Lua's stack without asking for room.

Read the entry: A test host crash traced to Lua's stack

After commit 33bb727 added logging of Blizzard's own consistency reports, the test host crashed and Windows reported native heap corruption. I chose to find the cause.

Lua promises a C function only 20 free stack slots and doesn't check pushes beyond them in a release build. GetChildren on a big frame, in the probe's template dump, pushed far more and overwrote the heap. The new logging had only moved memory around enough to make it fatal.

Every push now asks Lua for room first; past Lua's limit it becomes a Lua error. Two tests push 5,000 and 10,000 values. 767 tests pass with the logging still on.