Skip to content

winch: Fix missing zero-extensions of addresses loaded from#13014

Merged
cfallin merged 5 commits intobytecodealliance:mainfrom
alexcrichton:fix-winch-loads
Apr 9, 2026
Merged

winch: Fix missing zero-extensions of addresses loaded from#13014
cfallin merged 5 commits intobytecodealliance:mainfrom
alexcrichton:fix-winch-loads

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This is a combined set of fixes for GHSA-xx5w-cvp6-jv83 and GHSA-f984-pcp8-v2p7.

This commit fixes an out-of-bounds access caused by the lack zero
extension in the code responsible for calculating the heap address for
loads/stores.

This issue manifests in aarch64 (unlike x64) given that no automatic
extension is performed, resulting in an out-of-bounds access.

An alternative approach is to emit an extend for the index, however
this approach is preferred given that it gives the MacroAssembler
layer better control of how to lower addition, e.g., in aarch64 we can
inline the desired extension in a single instruction.
This commit fixes an out-of-bounds access caused by the lack of type
narrowing from the `table.grow` builtin. Without explicit narrowing,
the type is treated as 64-bit value, which could cause issues when
paired with loads/stores.
Only narrow when dealing with the 64-bit pointer/32-bit tables
This commit refines the zero extension heuristic such that it
unconditionally emits a zero extension when dealing with 32-bit
heaps. This eliminates any ambiguity related to the value of the
memory indices across ISAs.
@alexcrichton alexcrichton requested review from a team as code owners April 9, 2026 18:54
@alexcrichton alexcrichton requested review from cfallin and removed request for a team April 9, 2026 18:54
@cfallin cfallin enabled auto-merge April 9, 2026 18:55
@cfallin cfallin added this pull request to the merge queue Apr 9, 2026
Merged via the queue into bytecodealliance:main with commit 3aab955 Apr 9, 2026
48 checks passed
@alexcrichton alexcrichton deleted the fix-winch-loads branch April 9, 2026 20:16
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.

3 participants