String escaping fuzz bug with wasm-metadce
メンテナーはふだん 1 日以内に返信
@kripken がすでに取り組んでいます。
2026年3月20日 から。
評価
この issue はまだ評価されていません。
説明
This is a fuzz bug where the fuzzer runs the CtorEval handler with test/lit/basic/name-high-bytes.wast as its initial contents.
test.wast (reduced):
(module
(type $0 (func))
(export "test\\c3\\a9_invoker" (func $0))
(func $0 (type $0)
(unreachable)
)
)
graph.json produced by fuzz_opt.py's filter_exports (reduced):
[
{
"name": "outside",
"reaches": ["export-test\\\\c3\\\\a9_invoker"],
"root": true
},
{
"name": "export-test\\\\c3\\\\a9_invoker",
"export": "test\\\\c3\\\\a9_invoker"
}
]
Here we have an export name containing backslashes. Note that they are escaped in the Wasm text format, so the actual unescaped byte content of the export name is test\c3\a9_invoker. But fuzz_opt.py is not unescaping the string it reads from the disassembly, and then it is JSON-encoding the escaped name, so graph.json ends up with doubly escaped backslashes.
To make matters worse, wasm-metadce is parsing the input JSON in "ASCII" mode, which does not do any unescaping either. So wasm-metadce is rooting an export named test\\\\c3\\\\a9_invoker but in fact the export's name is test\c3\a9_invoker, so the export is removed and the filtered module is empty.
This causes the fuzzer to fail when it later runs wasm-ctor-eval and passes it --kept-exports=test\c3\a9_invoker (note that it has unescaped the string for this step). This errors out because that export no longer exists.
IIUC, the proper fix would be to 1) perform Wasm text format unescaping immediately when extracting export names in get_exports, and 2) perform JSON unescaping when parsing the JSON in wasm-metadce.
- 主要言語
- WebAssembly
- スター
- 8.6k
- フォーク
- 892
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 79
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
WebAssembly/binaryen のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
WebAssembly/binaryen#9185 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
WebAssembly/binaryen#9135 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 76/100
WebAssembly/binaryen#9018 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
WebAssembly/binaryen#9186 ·
メンテナーはふだん 1 日以内に返信
-
LoopInvariantCodeMotion: `struct.new` is hoisted out of a loop, so all iterations share one objectオープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
WebAssembly/binaryen#9184 ·
メンテナーはふだん 1 日以内に返信