Skip to content

fix(ems): avoid abort in gc_migrate when heap metadata is corrupted#4862

Merged
lum1n0us merged 1 commit intobytecodealliance:mainfrom
kylo5aby:ems
Mar 5, 2026
Merged

fix(ems): avoid abort in gc_migrate when heap metadata is corrupted#4862
lum1n0us merged 1 commit intobytecodealliance:mainfrom
kylo5aby:ems

Conversation

@kylo5aby
Copy link
Contributor

@kylo5aby kylo5aby commented Mar 4, 2026

When app heap lives inside linear memory (e.g. heap_offset=0), wasm code
can overwrite HMU headers. During memory.grow, gc_migrate walks the
heap and may read a corrupted size, causing cur to overshoot end. The
bh_assert(cur == end) then aborts the process.

Make the integrity checks unconditional in gc_migrate: validate size
before advancing (size <= 0 || size > remaining) and cur == end after
the walk. Return GC_ERROR instead of asserting.

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>
@lum1n0us lum1n0us merged commit 7233982 into bytecodealliance:main Mar 5, 2026
717 of 718 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