WebAssembly / WebAssembly/binaryen

Consider running tests with -D_LIBCPP_ENABLE_ASSERTIONS=1

Open
#5,245 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

There's a handful of instances across binaryen/wasm-opt where there is "technically C++ Undefined Behavior". These code defects may be causing nondeterminism, or random failures.

For example, https://github.com/WebAssembly/binaryen/blob/main/src/wasm/wasm-s-parser.cpp#L1154, str.size() is checked to be >= 3, and then str[3] is accessed. There's a few more instances in wasm-s-parser.cpp, for what it's worth. They should all be easy fixes :)

Building all of binaryen with -D_LIBCPP_ENABLE_ASSERTIONS=1 should point out these issues pretty quickly, or running the existing fuzzer after enabling this build macro. More info on this build macro: https://libcxx.llvm.org/DesignDocs/DebugMode.html (This is a clang-LLVM only thing).

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

Start by building Binaryen with -D_LIBCPP_ENABLE_ASSERTIONS=1, or run the existing fuzzer with that macro enabled. Inspect src/wasm/wasm-s-parser.cpp around line 1154 and its other similar cases, then address the undefined-behavior instances identified by the assertions; done means the affected tests or fuzzer run without triggering them.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.