Harden dumpDebugLoc against malformed .debug_loc sections
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start in dumpDebugLoc in third_party/llvm-project/dwarf2yaml.cpp, where the exit(1) on a null list sits, and read parseOneLocationList to see how entry.Loc is sized before the copy. Check how the address size is taken from the first CU. Done means a malformed list prints a warning and skips the rest of the section instead of exiting, the entry.Loc length is bounded, and a debug-build assert covers the shared address size. The issue does not give the length limit, so that needs a maintainer decision.
由索引模型根據 Issue 內容生成。
描述
Background:
#6879 was a SIGSEGV in dumpDebugLoc for modules with empty .debug_loc
sections. Fixed by #7910 with a null-CU guard. While reviewing that fix,
three defensive improvements to the same function became apparent. None
is a regression, but each turns a malformed-input case into a hard
failure when it could fail gracefully.
Location: third_party/llvm-project/dwarf2yaml.cpp, dumpDebugLoc.
-
exit(1)on parse failure.if (!list) { errs() << "debug_loc error\n"; exit(1); }A single malformed location list aborts the entire
wasm-optrun. A
warning plus break (skip the rest of the section) would let the tool
finish processing the module with incomplete debug info, which is
the behavior for every other diagnostic in wasm-opt. -
Unbounded copy of location expression bytes.
entry.Locis read from the section byparseOneLocationList. There is
no upper bound on its length before the copy intoloc.Location. A
malformed length field causes unbounded allocation. -
Address-size heuristic.
The comment "should be ok since they all have the same address size?"
is a heuristic. All CUs in well-formed modules share the same
AddrSize, so reading it from the first CU is safe in practice, but
the assumption is not enforced.
Proposed changes:
- Replace
exit(1)with a warning and break. - Add a length sanity check before copying
entry.Loc. - Promote the
address-sizecomment from a question to an explicit
assumption with a debug-build assert.
Refs #6879, #7910.
- 主要語言
- WebAssembly
- 星號
- 8.7k
- 分支
- 903
- 平均合併
- 2 天 5 小時
- 30 天內合併 PR
- 106
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
WebAssembly/binaryen 的其他 Issue
-
難度 1/5 1 小時以內 新手友好度 88/100
WebAssembly/binaryen#9135 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 半天 新手友好度 76/100
WebAssembly/binaryen#9018 · 3 則留言 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 45/100
WebAssembly/binaryen#9307 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 76/100
WebAssembly/binaryen#9291 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 62/100
WebAssembly/binaryen#9257 · 2 則留言 ·
維護者通常 1 天內回覆
查看 WebAssembly/binaryen 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
needs-triage type: bug
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
pytorch/executorch#24434 ·
維護者通常 1 天內回覆
-
bug devex good first issue
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
calcit-lang/calcit#2538 ·
維護者通常 1 天內回覆