Skip to content

interp: assert stop_on_first_error in ReadBinaryInterp - #2816

Merged
sbc100 merged 2 commits into
WebAssembly:mainfrom
ANAMASGARD:fix/interp-assert-stop-on-first-error
Aug 16, 2026
Merged

sbc100 merged 2 commits into
WebAssembly:mainfrom
ANAMASGARD:fix/interp-assert-stop-on-first-error

Conversation

@ANAMASGARD

Copy link
Copy Markdown
Contributor

Summary

  • Assert that ReadBinaryInterp is only used with stop_on_first_error=true.
  • Documents that collect-all-errors mode is unsupported for the interp reader.

Follow-up to #2812 / #2747 ( @sbc100 ) .

Test plan

  • Debug: stop_on_first_error=false hits the assert
  • wabt-unittests (135 passed)

BinaryReaderInterp does not support collect-all-errors mode.
Follow-up to WebAssembly#2812 / WebAssembly#2747.

Signed-off-by: Gaurav Chaudhary <[email protected]>
Comment thread src/interp/binary-reader-interp.cc Outdated
break;
case ExternalKind::Tag:
type = tag_types_[item_index].Clone();
break;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this chunk (maybe this block needs to be in // clang-format off .. bit doesn't need to be part of this change).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done @sbc100 Thanks for the review

Revert unrelated OnExport clang-format rewrite. Follow-up to WebAssembly#2812 / WebAssembly#2747.

Signed-off-by: Gaurav Chaudhary <[email protected]>
@ANAMASGARD

Copy link
Copy Markdown
Contributor Author

CIFuzz is still failing because it uses the google/oss-fuzz harness (projects/wabt/read_binary_interp_fuzzer.cc) with
stop_on_first_error=false, not fuzzers/read_binary_interp_fuzzer.cc from this repo (which already passes true).

That hits the assert added here on purpose — no further wabt change needed for this. Fix is to set the 4th ReadBinaryOptions arg to true in oss-fuzz: https://github.com/google/oss-fuzz

Sir @sbc100 should I open a PR there directly, or file an issue first please give feedback ???

@sbc100

sbc100 commented Aug 10, 2026

Copy link
Copy Markdown
Member

It looks like maybe fuzzers/read_binary_interp_fuzzer.cc need updating here. I'll send a PR to https://github.com/google/oss-fuzz/ to change it hedre.

@sbc100

sbc100 commented Aug 10, 2026

Copy link
Copy Markdown
Member

google/oss-fuzz#15983

sbc100 added a commit to sbc100/oss-fuzz that referenced this pull request Aug 10, 2026
DavidKorczynski pushed a commit to google/oss-fuzz that referenced this pull request Aug 10, 2026
sbc100 pushed a commit that referenced this pull request Aug 11, 2026
`ReadBinaryIr` fails on any module that has a function in it once
`skip_function_bodies` is set. Reading sqlite (built with emscripten)
both ways:

```
skip_function_bodies=0 -> ok
skip_function_bodies=1 -> FAILED
    function 34 missing end marker
```

34 is just its first non-imported function, so it gives up on the first
body it reaches.

`BeginFunctionBody` pushes a label for the function, but with bodies
skipped the reader steps straight over the body and the `end` that would
pop that label never arrives. `EndFunctionBody` then sees it still
sitting on the stack and reports the body as missing its end marker.

The option was only ever meant for the objdump reader, which doesn't
build a module, so this declares it unsupported here instead of teaching
the IR reader to work around it, along the lines of #2816. Nothing in
the tree passes it to `ReadBinaryIr` today, so nothing starts asserting.

Fixes #2534.

Co-authored-by: nishad shabbir <[email protected]>
@ANAMASGARD

Copy link
Copy Markdown
Contributor Author

Sir @sbc100 can you please review once again and give feedback if anymore revisions are needed or not for this PR ?

@sbc100
sbc100 enabled auto-merge (squash) August 16, 2026 19:33
@sbc100
sbc100 disabled auto-merge August 16, 2026 19:34
@sbc100
sbc100 merged commit aee0a12 into WebAssembly:main Aug 16, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants