fix(scanner): repair prologue-fallback cascade recovery#112
Conversation
QW-8: carry the candidate's | anchor offset through the fallback resolve so a |-anchored Direct candidate recovers the same address as the unhooked direct scan. QW-9: gate the decoded E9 destination on a committed, execute-readable page instead of in-module, recovering SafetyHook trampolines VirtualAlloc'd outside every image. Harden .clang-format so CommentPragmas exempts hang-indented Doxygen doc-blocks from reflow, preventing the formatter from mangling them.
📝 WalkthroughWalkthroughThe PR refactors the cascade resolver's hooked-prologue fallback to relax jump destination validation from module-containment to executable-address checks, adds an ChangesPrologue Fallback Destination Relaxation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.clang-format:
- Around line 15-21: The current CommentPragmas regex ("CommentPragmas: '^ IWYU
pragma:|^ {3,}'") is too broad and prevents reflow for any comment line with 3+
leading spaces; narrow it to only match Doxygen hang-indented continuation lines
by changing the value of CommentPragmas to something that targets the Doxygen
continuation prefix (e.g. a pattern matching three leading spaces followed by an
asterisk and optional space). Update the CommentPragmas entry in .clang-format
(the CommentPragmas setting) to that tighter regex (for example: '^ IWYU
pragma:|^ {3}\\*\\s?') so ordinary indented // comments are not exempted.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 17a7580c-ffb2-4cbe-88a4-d9f47c15be87
📒 Files selected for processing (8)
.clang-formatAGENTS.mddocs/misc/aob-signatures.mdinclude/DetourModKit/scanner.hppsrc/scanner.cppsrc/scanner_cascade.cppsrc/scanner_internal.hpptests/test_scanner.cpp
Summary
The cascade resolver's hooked-prologue fallback had two correctness bugs that made recovery of an already inline-hooked target either fail or resolve to a wrong address. This fixes both and hardens the formatter config so doc-blocks are not mangled.
|anchor offset, so a|-anchored Direct candidate recovered an address short by that offset. The offset is now carried through the fallback resolve, so recovery matches the unhooked direct scan exactly..clang-formatnow exempts hang-indented Doxygen doc-blocks from reflow viaCommentPragmas, so the formatter no longer mangles them while still reflowing plain//comments.Adds regression tests for trampoline recovery outside any module, data-only destination rejection, and
|-anchor offset preservation. Updates the docs and the public contract. No public API change.Summary by CodeRabbit
Documentation
Bug Fixes
Tests