Skip to content

"RuntimeError: out of bounds memory access" (C++ -> Wasm via Enscripten) #5324

Open
@KieranP

Description

@KieranP

Describe the bug

I'm using enscripten to convert a C++ project (https://github.com/KieranP/Game-Of-Life-Implementations/tree/master/c%2B%2B) into WASM, and then using wasmer to run it. Compiling/running the application as C++ has no issues and enscripten reports no issues converting to wasm. When running with wasmer, am getting unexpected "RuntimeError: out of bounds memory access" errors.

wasmer 5.0.4 (??????? 2024-12-17)
binary: wasmer-cli
commit-hash: 
commit-date: 2024-12-17
host: aarch64-apple-darwin
compiler: cranelift
c_api backend: 

rustc 1.83.0 (90b35a623 2024-11-26) (Homebrew)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: aarch64-apple-darwin
release: 1.83.0
LLVM version: 19.1.6

Steps to reproduce

$ emcc -o play.wasm play.cpp
$ wasmer run play.wasm     
error: RuntimeError: out of bounds memory access
╰─▶ 1: RuntimeError: out of bounds memory access

Expected behavior

Should run without error. Errors should also indicate the cause a bit more clearly.

Actual behavior

Throws error that doesn't exist when running as C++ project. Location of out of bounds memory access unknown.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working🕵️ needs investigationThe issue/PR needs further investigation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions