WebAssembly / WebAssembly/wabt

wast2json assertion failure when file contains malformed module

Open Beginner friendly
#1,399 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
8.1k
Forks
827
Avg merge
4d 6h
Merged PRs (30d)
18

Description

For the input file

(module quote "")

wast2json 1.0.13 crashes:

$ wast2json malformed.wast --no-check
wast2json: /home/andrei/dev/wabt/src/wast-parser.cc:474: wabt::Token wabt::WastParser::Consume(): Assertion `!tokens_.empty()' failed.
Aborted (core dumped)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with the shown malformed.wast input and --no-check command. Inspect src/wast-parser.cc around Consume() line 474, then trace how the malformed module leaves the parser without tokens; done means wast2json handles this input without an assertion failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.