Skip to content

[codex] Guard PDB field-list recursion#8287

Draft
plafosse wants to merge 1 commit into
devfrom
test_d2-pdb-fieldlist-recursion-limit
Draft

[codex] Guard PDB field-list recursion#8287
plafosse wants to merge 1 commit into
devfrom
test_d2-pdb-fieldlist-recursion-limit

Conversation

@plafosse

Copy link
Copy Markdown
Member

Warning

This patch was completely vibe coded. Treat it as a CI and validation candidate, not a reviewed final fix.

Refs Vector35/binaryninja#1620

Rationale

The D2 Sentry crash points at a stack overflow while Binary Ninja imports PDB type information. The likely failure path is below pdb-ng's existing type-resolution guard: pdb-rs recursively parses nested LF_FIELDLIST records while building raw TypeData, so malformed or adversarial PDB input can recurse before pdb-ng gets a chance to apply its own type_stack limits.

This PR changes that parser path to fail closed with a typed recursion-limit error instead of exhausting the process stack.

What Changed

  • Vendor the pinned pdb-rs source used by pdb-ng so the parser fix is local to the plugin build.
  • Switch both pdb-ng manifests to use the vendored path dependency.
  • Add TypeRecordRecursionLimit and cap nested LF_FIELDLIST parsing at 32 levels.
  • Add a focused unit test for the nested field-list case.
  • Include vendored source files in the CMake dependency list so changes trigger rebuilds.

Validation

  • Passed: cargo +1.91.1-aarch64-apple-darwin test --manifest-path /private/tmp/pdb-rs-test/Cargo.toml --offline --lib fieldlist_recursion_limit
  • Note: direct workspace Cargo runs are blocked locally by unrelated parent-workspace/toolchain issues, so CI should validate the integrated build on this test_ branch.

@plafosse plafosse force-pushed the test_d2-pdb-fieldlist-recursion-limit branch from 74ed5e3 to 39bbb05 Compare June 26, 2026 14:10
@plafosse plafosse requested a review from CouleeApps June 26, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant