WebAssembly / WebAssembly/binaryen
Consider running tests with -D_LIBCPP_ENABLE_ASSERTIONS=1
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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