feat(decompiler): Rec 31 #31-2 — cppRaiiAudit per-file gate for RAII Stage 1#45
Merged
Merged
Conversation
…Stage 1 Adds `gradle cppRaiiAudit` as a new verification task modeled on ignoreAudit / objectInputStreamAudit. The task walks the protected file set and forbids raw `new <ClassName>(...)` or `new <ClassName>[...]` allocations — the RAII idiom we want is `std::make_unique<T>(...)` or `std::make_shared<T>(...)` (or stack / value allocation), so smart pointers never produce raw pointers to leak across an API boundary. Stage 1 protected set: - Ghidra/Features/Decompiler/src/decompile/cpp/address.cc - Ghidra/Features/Decompiler/src/decompile/cpp/space.cc - Ghidra/Features/Decompiler/src/decompile/cpp/rangeutil.cc In-tree state: all three files were already raw-`new`-free (the audit's mention of `range.cc` maps to `rangeutil.cc` in the current tree; the other two never had raw owning allocations). This PR therefore lays the gate to fail CI on any future regression that reintroduces a raw owning pointer in the protected set — it doesn't itself migrate any code. Wiring: - gradle/cppRaiiAudit.gradle — new task with PROTECTED_FILES allowlist - build.gradle — apply line alongside other audits - .github/workflows/build-ghidra.yml — `Audit C++ RAII protected files` step Subsequent stages (#31-3, #31-4, ...) extend PROTECTED_FILES as more files are RAII-converted. The tree-wide "no raw new in cpp/" lint described as #31-10 in RAII_MIGRATION.md is the broader form of this same gate. Closes #31-2 of Rec 31. Docs updated: - docs/decompiler/RAII_MIGRATION.md — sequencing table now carries Status column with shipped/open per row. - SprintPlanning.md — Sprint 6 #31-2 row marked shipped. Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
gradle cppRaiiAuditas a new verification task modeled onignoreAudit/objectInputStreamAudit. The task walks the protected file set and forbids rawnew <ClassName>(...)ornew <ClassName>[...]allocations — the RAII idiom we want isstd::make_unique<T>(...)orstd::make_shared<T>(...)(or stack / value allocation), so smart pointers never produce raw pointers to leak across an API boundary.Stage 1 protected set:
Ghidra/Features/Decompiler/src/decompile/cpp/address.ccGhidra/Features/Decompiler/src/decompile/cpp/space.ccGhidra/Features/Decompiler/src/decompile/cpp/rangeutil.ccIn-tree state: all three files were already raw-
new-free (the audit's mention ofrange.ccmaps torangeutil.ccin the current tree; the other two never had raw owning allocations). This PR therefore lays the gate to fail CI on any future regression that reintroduces a raw owning pointer in the protected set — it doesn't itself migrate any code.Wiring:
gradle/cppRaiiAudit.gradle— new task withPROTECTED_FILESallowlist.build.gradle— apply line alongside other audits..github/workflows/build-ghidra.yml—Audit C++ RAII protected filesstep.Subsequent stages (#31-3, #31-4, ...) extend
PROTECTED_FILESas more files are RAII-converted. The tree-wide "no raw new in cpp/" lint described as #31-10 inRAII_MIGRATION.mdis the broader form of this same gate.Docs updated:
docs/decompiler/RAII_MIGRATION.md— sequencing table now carries Status column with shipped/open per row.SprintPlanning.md— Sprint 6 chore(rec-28): delete DBTraceRegisterContextManagerTest empty-stub — wip sweep #31-2 row marked shipped.Closes #31-2 of Rec 31.
Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/