Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Harden dumpDebugLoc against malformed .debug_loc sections

Offen
#9,249 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
cpp, wasm
Bereich
compilers

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
WebAssembly
Sterne
8.7k
Forks
895
Ø Merge
2 T. 21 Min.
Gemergte PRs (30 T.)
100

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus WebAssembly/binaryen

Alle Issues in WebAssembly/binaryen

Ähnliche Issues

Weitere Issues zu Compilers

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.