Fix container-overflow in BinaryReaderInterp (#2747) - #2812
Open
ANAMASGARD wants to merge 2 commits into
Open
Conversation
When stop_on_first_error=false, a failed OnFunction left module_.funcs empty while OnFunctionCount had reserved capacity. BeginFunctionBody then wrote past the vector's logical end (ASan container-overflow). Add OnFunctionBodyCount guard matching the established BinaryReaderIR pattern, adapted for interp where module_.funcs holds defined funcs only. Fixes WebAssembly#2747 Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
Wrap comments and reformat the PoC byte array to satisfy scripts/clang-format-diff.sh. Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
Member
|
If this only applies with |
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.
Fixes #2747
Summary
OnFunctionBodyCountguard toBinaryReaderInterpto prevent container-overflow whenstop_on_first_error=falseand the Function section fails before allFuncDescentries are appended.count != module_.funcs.size()(interp stores defined funcs only, unlike IR reader).Test plan
./wabt-unittests --gtest_filter='InterpTest.FunctionBodyCountMismatchWithCollectErrors'./wabt-unittestsstop_on_first_error=falsereturns error without crash