Skip to content

wat2wasm aborts when function has undefined reference type in parameter #2097

Open
@imofftoseethewizard

Description

The following module

(module
  (func (param (ref $T)) (result)
    (nop)))

aborts in both the current main HEAD and the most recent package version on Ubuntu 20.04:

pat@quercus:~/src/crack$ ../wabt/bin/wat2wasm --version
1.0.31 (git~1.0.31-22-ged0b720c)

pat@quercus:~/src/crack$ ../wabt/bin/wat2wasm --enable-function-references scratch.wat -o scratch.wasm
wat2wasm: /home/pat/src/wabt/src/wast-parser.cc:327: void wabt::(anonymous namespace)::ResolveTypeName(const wabt::Module &, wabt::Type &, wabt::Index, const std::unordered_map<uint32_t, std::string> &): Assertion `type_index != kInvalidIndex' failed.
Aborted (core dumped)

pat@quercus:~/src/crack$ wat2wasm --version
1.0.27

pat@quercus:~/src/crack$ wat2wasm --enable-function-references scratch.wat -o scratch.wasm
wat2wasm: ./src/wast-parser.cc:279: void wabt::{anonymous}::ResolveTypeName(const wabt::Module&, wabt::Type&, wabt::Index, const std::unordered_map<unsigned int, std::__cxx11::basic_string<char> >&): Assertion `type_index != kInvalidIndex' failed.
Aborted (core dumped)

If (ref $T) is replaced with $T, I get an error message. Not a huge problem, just a little confusing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions