Skip to content

Commit a9f6bc0

Browse files
authored
Add a missing binary reading check for BrOn's reference child's type (#6700)
That child must be a reference, as `finalize()` assumes so. To avoid an assertion, error early. Fixes #6696
1 parent 4e07d86 commit a9f6bc0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/wasm/wasm-binary.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7320,6 +7320,9 @@ bool WasmBinaryReader::maybeVisitBrOn(Expression*& out, uint32_t code) {
73207320
}
73217321
auto name = getBreakTarget(getU32LEB()).name;
73227322
auto* ref = popNonVoidExpression();
7323+
if (!ref->type.isRef() && ref->type != Type::unreachable) {
7324+
throwError("bad input type for br_on*");
7325+
}
73237326
if (isCast) {
73247327
auto inputNullability = (flags & 1) ? Nullable : NonNullable;
73257328
auto castNullability = (flags & 2) ? Nullable : NonNullable;

0 commit comments

Comments
 (0)