Fix/branch hint parse issue#4878
Merged
lum1n0us merged 5 commits intobytecodealliance:mainfrom Mar 20, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds build-time support and documentation for the Branch Hints feature, hardens the wasm loader’s branch-hint custom section parsing, and introduces regression coverage for related loader issues.
Changes:
- Add
WAMR_BUILD_BRANCH_HINTSbuild flag wiring and update build/reporting output. - Add loader-side validation for branch hint counts/offsets and adjust logging when hints are present but disabled.
- Add regression test cases and sample
.wasmfixtures for branch-hint loader failures.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
core/iwasm/interpreter/wasm_loader.c |
Adds branch-hint validation (count/offset), introduces branch-instruction counting helper, adjusts logging severity when feature disabled. |
build-scripts/config_common.cmake |
Adds build configuration message + definition to enable WASM_ENABLE_BRANCH_HINTS. |
tests/regression/ba-issues/build_wamr.sh |
Adds a dedicated iwasm build variant with branch hints enabled for regression runs. |
tests/regression/ba-issues/running_config.json |
Registers two new regression test entries for branch-hint loader failures. |
tests/regression/ba-issues/issues/issue-980002/create_samples.py |
Adds script to generate the crafted branch-hint .wasm samples. |
tests/regression/ba-issues/issues/issue-980002/branch_hint_invalid_free.wasm |
Adds crafted wasm fixture for invalid hint sizing/structure. |
tests/regression/ba-issues/issues/issue-980003/branch_hint_null_deref.wasm |
Adds crafted wasm fixture for oversized hint-count input. |
doc/build_wamr.md |
Documents the WAMR_BUILD_BRANCH_HINTS option and intent. |
doc/tiered_support.md |
Lists Branch Hints in the tiered support matrix with a link to build documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Stephen Berard <stephen.berard@outlook.com>
Signed-off-by: Stephen Berard <stephen.berard@outlook.com>
```bash $ pwd /workspaces/wasm-micro-runtime/tests/regression/ba-issues $ ./run.py -i 980002,980003 ```
ceafe3d to
3b88f0e
Compare
Contributor
Author
|
Rebased. |
lum1n0us
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes two security issues in experimental branch hint support (WASM_ENABLE_BRANCH_HINTS=1) reported by @Finder16.
Summary
These issues only affect builds with branch hints enabled, which is currently an experimental, opt-in feature.