Fix memory64: u64 offset decoding and address handling#22
Merged
Conversation
memory64 spec requires u64 LEB128 offsets in memarg and i64 stack addresses, but zwasm was using u32 throughout. This caused CI failures after wasm-tools 1.246.1 started encoding memory64 offsets correctly. Changes: - memory.zig: read/write accept u64 offset+address with overflow detection - module.zig: validateBodyEnd reads offsets as u64 (body scanner) - validate.zig: conditional u64/u32 offset based on memAddrType(memidx) - predecode.zig: read u64 offset, bail to interpreter if > u32_max - vm.zig: readMemarg returns u64 offset for memory64; all load/store/ atomic/SIMD memory ops pop i64 address for memory64 memories Fixes E2E: memory64_offsets (decode overflow), memory64_threads (atomic OOB with large addresses). Spec 62263/0/0, E2E 795/0.
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.
Summary
Fixes CI failures introduced by wasm-tools 1.246.1 bump (PR #21) which correctly encodes memory64 offsets as u64.
Test plan
zig build test— Mac + Ubuntu (0 fail, 0 leak)