Skip to content

fix: added trap for non-aligned list pointers - #25

Merged
Jairus (JairusSW) merged 1 commit into
wago-org:mainfrom
asteurer:conformance-values-realloc-0006-L93
Oct 1, 2026
Merged

Jairus (JairusSW) merged 1 commit into
wago-org:mainfrom
asteurer:conformance-values-realloc-0006-L93

Conversation

@asteurer

@asteurer asteurer commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Enforce realloc pointer alignment when lowering lists

Fixes upstream conformance test values__realloc__0006__L93/action/L94.

When lowering a list<T> into a component's memory, Wago calls that component's realloc canon option and doesn't check whether it was aligned to T's alignment, so a realloc returning e.g. 2 for a list<u32> doesn't trap.

allocStoreList (internal/abi/memory.go) now rejects a misaligned pointer immediately after realloc and before the bounds check. This matches the Canonical ABI's store_list_into_range, where erroneous alignments trap immediately after the pointer is assigned.

Unchanged

  • The new error is a plain host error, so it does not poison the instance, although realloc is guest code. Out of scope for this fix.

Signed-off-by: Andrew Steurer <94206073+asteurer@users.noreply.github.com>
@JairusSW

JairusSW commented Oct 1, 2026

Copy link
Copy Markdown
Member

looks good, thank you

@JairusSW
Jairus (JairusSW) merged commit d96ac87 into wago-org:main Oct 1, 2026
3 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