Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staticlib engine causes rust panic when creating a wasm instance #2590

Closed
HeliosPanoptes opened this issue Sep 30, 2021 · 2 comments · Fixed by #2693
Closed

Staticlib engine causes rust panic when creating a wasm instance #2590

HeliosPanoptes opened this issue Sep 30, 2021 · 2 comments · Fixed by #2693
Assignees
Labels
bug Something isn't working priority-high High priority issue
Milestone

Comments

@HeliosPanoptes
Copy link

Describe the bug

wasmer 2.0.0 | rustc 1.54.0-nightly (3e99439f4 2021-05-17) | x86_64

When making a wasm module instance with the staticlib engine, wasmer panics:

thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/GW/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-vm-2.0.0/src/instance/mod.rs:1079:29

Here is a test project.
wasmer-bug.zip

When digging in to the stack trace, at lookup_by_declaration wasmer-vm-2.0.0/src/instance/mod.rs:1079,
instance-ref.functions.elems.length is 0. When instantiating a module with universal or dylib, the length instead shows up as 2.

Steps to reproduce

For example,

  1. Open the test project: wasmer-bug.zip
  2. Run with cargo run -- --engine universal test.wasm
  3. See an output value
  4. Run with cargo run -- --engine staticlib test.wasm
  5. See the panic dump

Expected behavior

That wasmer does not panic when using staticlib

Actual behavior

That wasmer panics when using staticlib

Additional context

None that I can think of.

@HeliosPanoptes HeliosPanoptes added the bug Something isn't working label Sep 30, 2021
@Amanieu Amanieu added the priority-high High priority issue label Oct 20, 2021
@Amanieu Amanieu added the 🕵️ needs investigation The issue/PR needs further investigation label Nov 3, 2021
@Amanieu Amanieu added this to the v2.1 milestone Nov 3, 2021
@Amanieu Amanieu self-assigned this Nov 3, 2021
@Amanieu Amanieu removed the 🕵️ needs investigation The issue/PR needs further investigation label Nov 5, 2021
@bors bors bot closed this as completed in 8f2e49d Nov 23, 2021
@orangeC23
Copy link

I found this problem occurred again, in macOS with wasmer2.3.0.
WechatIMG1244

@epilys
Copy link
Contributor

epilys commented Jul 18, 2022

@Zhangyx24 your screenshot says the verson is 2.0.0. Can you retry with 2.3.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-high High priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants