Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Harden dumpDebugLoc against malformed .debug_loc sections

オープン
#9,249 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp, wasm
領域
compilers

調査の方向性

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.

  1. exit(1) on parse failure.

    if (!list) {
      errs() << "debug_loc error\n";
      exit(1);
    }
    

    A single malformed location list aborts the entire wasm-opt run. 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.

  2. Unbounded copy of location expression bytes.

    entry.Loc is read from the section by parseOneLocationList. There is
    no upper bound on its length before the copy into loc.Location. A
    malformed length field causes unbounded allocation.

  3. 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-size comment from a question to an explicit
    assumption with a debug-build assert.

Refs #6879, #7910.

主要言語
WebAssembly
スター
8.7k
フォーク
895
平均マージ
1日 22時間
マージ済み PR(30日)
97

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

WebAssembly/binaryen のほかの issue

WebAssembly/binaryen の issue をすべて見る

似ている issue

Compilers の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。