Problem
Several places use assert() for error conditions that can occur at runtime:
- WasmStackEmitter.cpp:106 —
assert(!emitter.labelStack.empty() && ...)
- VerifyWasmStack.cpp:312 —
assert(ctx && "MLIRContext not initialized")
Why this matters
assert() is stripped in release builds (-DNDEBUG). If these conditions are hit in a release build:
- Case 1: Proceeds with invalid state, causing undefined behavior
- Case 2: Null pointer dereference
Expected behavior
Replace assert() with proper error handling using emitError() / return failure() so that invalid states are caught regardless of build configuration.
Location
lib/wasmstack/WasmStackEmitter.cpp, line 106
lib/wasmstack/VerifyWasmStack.cpp, line 312
Problem
Several places use
assert()for error conditions that can occur at runtime:assert(!emitter.labelStack.empty() && ...)assert(ctx && "MLIRContext not initialized")Why this matters
assert()is stripped in release builds (-DNDEBUG). If these conditions are hit in a release build:Expected behavior
Replace
assert()with proper error handling usingemitError()/return failure()so that invalid states are caught regardless of build configuration.Location
lib/wasmstack/WasmStackEmitter.cpp, line 106lib/wasmstack/VerifyWasmStack.cpp, line 312