Fix off-by-one in AOT func_index bounds checks#4836
Merged
lum1n0us merged 1 commit intobytecodealliance:mainfrom Feb 13, 2026
Merged
Fix off-by-one in AOT func_index bounds checks#4836lum1n0us merged 1 commit intobytecodealliance:mainfrom
lum1n0us merged 1 commit intobytecodealliance:mainfrom
Conversation
Contributor
|
The modification is valid, but you may want to modify the unit test case, current it's not make any sense, I suggest modify to actually cover your modification, or simply remove it would be fine too. |
The AOT relocation loader validates func_index using: (func_index = (uint32)atoi(p)) > module->func_count Since func_ptrs is an array of func_count elements (indices 0 to func_count-1), func_index == func_count is out of bounds. The check must use >= instead of > to reject this boundary case. Fix all 4 affected locations in aot_loader.c.
13c7aef to
198fee8
Compare
Contributor
Author
|
Removed. |
TianlongLiang
approved these changes
Feb 12, 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.
The AOT relocation loader validates
func_indexparsed from symbols likeaot_func#Nusing:Since
func_ptrsis allocated with exactlyfunc_countelements (indices 0 tofunc_count-1),func_index == func_countis out of bounds but passes the>check.This patch changes
>to>=in all 4 affected locations indo_text_relocation()anddo_data_relocation().