Wasmer: Simple emscripten wasm causes error

Created on 6 Mar 2019  ยท  9Comments  ยท  Source: wasmerio/wasmer

(module
  (type $t0 (func (result i32)))
  (type $t1 (func (param i32 i32 i32) (result i32)))
  (import "env" "_emscripten_memcpy_big" (func $env._emscripten_memcpy_big (type $t1)))
  (func $main (export "main") (type $t0) (result i32)
    i32.const 0)
  (memory $memory (export "memory") 2 10)
  (global $g0 i32 (i32.const 0))
  (global $g1 (mut i32) (i32.const 0)))
๐Ÿž bug

Most helpful comment

This project is extremely alpha and written in Rust

https://github.com/wasplang/wasp

here's the code I generated the wasm from:

https://github.com/wasplang/wasp/blob/master/examples/wasmer/main.w

All 9 comments

wasmer run wasmer.wasm
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /home/circleci/project/lib/runtime-core/src/structures/slice.rs:58:10
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Makefile:2: recipe for target 'run' failed
make: *** [run] Error 101

hello @richardanaya, and thanks for reporting the crash! That example seems like it should just work ๐Ÿ™ƒ

Can you tell us what version of wasmer (from source, or installer) you're using, and what OS you're on? Thanks!

2.1 on Linux, I think right now there are some strong assumptions in code
that I import table and memory

On Thu, Mar 7, 2019 at 9:02 AM Mackenzie Clark notifications@github.com
wrote:

hello @richardanaya https://github.com/richardanaya, and thanks for
reporting the crash! That example seems like it should just work ๐Ÿ™ƒ

Can you tell us what version of wasmer (from source, or installer) you're
using, and what OS you're on? Thanks!

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/wasmerio/wasmer/issues/244#issuecomment-470608690,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAR8mtMP3X6y-2aS-opvv9vsyIHhz42aks5vUUYYgaJpZM4bh26z
.

I also was able to repro on source

On Thu, Mar 7, 2019 at 9:26 AM Richard Anaya richard.anaya@gmail.com
wrote:

2.1 on Linux, I think right now there are some strong assumptions in code
that I import table and memory

On Thu, Mar 7, 2019 at 9:02 AM Mackenzie Clark notifications@github.com
wrote:

hello @richardanaya https://github.com/richardanaya, and thanks for
reporting the crash! That example seems like it should just work ๐Ÿ™ƒ

Can you tell us what version of wasmer (from source, or installer) you're
using, and what OS you're on? Thanks!

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/wasmerio/wasmer/issues/244#issuecomment-470608690,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAR8mtMP3X6y-2aS-opvv9vsyIHhz42aks5vUUYYgaJpZM4bh26z
.

Did you generate this module from source code (e.g. with emscripten or cargo) or did you write it by hand? It seems odd that it is exporting a memory. This is not a judgement, just an observation.

I have a simple programming language for web assembly that exposes its
memory by default so that browser host can send memory into the wasm module.

On Thu, Mar 7, 2019 at 10:35 AM Mackenzie Clark notifications@github.com
wrote:

Did you generate this module from source code (e.g. with emscripten or
cargo) or did you write it by hand? It seems odd that it is exporting a
memory. This is not a judgement, just an observation.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/wasmerio/wasmer/issues/244#issuecomment-470642598,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAR8mi1VTqZs3IRwzWE_bB5bNVsCjKIiks5vUVvVgaJpZM4bh26z
.

Wow very cool! I am actually super curious to hear about how you're doing that and how it's going ๐Ÿ˜ป

There may be some edge case we are not accounting for. Emscripten is a funny thing. Regardless, Wasmer should not crash here. We should at least get an elegant failure. I am taking a look into this soonish.

This project is extremely alpha and written in Rust

https://github.com/wasplang/wasp

here's the code I generated the wasm from:

https://github.com/wasplang/wasp/blob/master/examples/wasmer/main.w

Emscripten requires at least one imported table. We are pushing a change to throw an exception when that's not the case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robinvanemden picture robinvanemden  ยท  4Comments

webmaster128 picture webmaster128  ยท  4Comments

bkolobara picture bkolobara  ยท  3Comments

RReverser picture RReverser  ยท  4Comments

vitiral picture vitiral  ยท  4Comments