Skip to content

wasm trap: out of bounds memory access error #5198

@rajatjindal

Description

@rajatjindal

Imp note: I have used claude to debug this issue and it helped me identify this root cause.

Runtime on: Macos Sonoma Version 14.6.1. M2 Pro, ARM
Golang: go version go1.25.5 darwin/arm64
build command used: tinygo build -target=wasi -buildmode=c-shared -no-debug -o main.wasm .

I was testing why a sample spin example was not working with tinygo-v0.40.1, but worked with tinygo-v0.39.0, and with help from claude, it pointed to this commit: 82decca

The error I was getting with v0.40.1 was: wasm trap out of bounds memory access.

Once I reverted this change on my local setup, and ran my app again. it worked this time.

I am attaching the wasm file generated with both the versions (incase its helpful) (I could not attach the wasm files here).

Although I was able to test and reproduce this issue with spin, please let me know if reproducing this using just tinygo and/or wasmtime is needed and I will try my best to provide a repro using that.

Thank you for your help as always.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnext-releaseWill be part of next releasewasmWebAssembly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions