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

Valid Wasm module fails validation #79

Closed
fitzgen opened this issue Aug 19, 2020 · 2 comments · Fixed by #80
Closed

Valid Wasm module fails validation #79

fitzgen opened this issue Aug 19, 2020 · 2 comments · Fixed by #80
Labels
wasmparser Related to the binary format of WebAssembly (wasmparser)

Comments

@fitzgen
Copy link
Member

fitzgen commented Aug 19, 2020

test.wasm.gz

(module
  (type (;0;) (func))
  (type (;1;) (func))
  (import "" "" (global (;0;) (mut i32)))
  (func (;0;) (type 1)
    (local f64)
    loop  ;; label = @1
      loop  ;; label = @2
        unreachable
        global.get 0
        global.get 0
        br_if 0 (;@2;)
        global.set 0
        unreachable
      end
      unreachable
    end
    unreachable))

I need to double check the spec and how unreachable code is validated, but all of wasm2wat, wasm-validate, and wasm-dis accept this module as valid, while wasmparser's validator returns an error.

@fitzgen fitzgen added the wasmparser Related to the binary format of WebAssembly (wasmparser) label Aug 19, 2020
@fitzgen
Copy link
Member Author

fitzgen commented Aug 19, 2020

It looks like our handling of br_if is accidentally un-setting the stack polymorphic bit on the block here.

fitzgen added a commit to fitzgen/wasm-tools that referenced this issue Aug 19, 2020
@yurydelendik
Copy link
Contributor

yurydelendik commented Aug 19, 2020

@fitzgen fitzgen mentioned this issue Aug 19, 2020
fitzgen pushed a commit to fitzgen/wasm-tools that referenced this issue Oct 21, 2020
These types are part of the exceptions proposal.
dhil added a commit to dhil/wasm-tools that referenced this issue Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmparser Related to the binary format of WebAssembly (wasmparser)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants