Fix hook size on CPtrNodeDoubleLinkPool::New overwriting the pool-full path - #5373
Open
Flashmyname wants to merge 1 commit into
Open
Fix hook size on CPtrNodeDoubleLinkPool::New overwriting the pool-full path#5373Flashmyname wants to merge 1 commit into
Flashmyname wants to merge 1 commit into
Conversation
Member
|
Is there a chance that this PR has any impact on #3298? |
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.
Summary
The hook at
0x55233Ereplaceslea eax,[ecx+eax*4]/pop esi/ret, which is 5 bytes, but is installed with a size of 6.HookInstallpads the extra byte with0x90, and that byte ispop ediat0x552343: the first instruction of the pathCPool<CPtrNodeDoubleLink>::Newtakes when the pool is full. That path then runsxor eax,eax/pop esi/retone stack entry off and returns to the caller's savedesi.CEntryInfoNodePool::Newat0x536D6Eis byte-identical and is already declared as 5.Motivation
Pool exhaustion is fatal either way, since GTA's callers write through the returned pointer without checking it, but with the correct size the fault stays inside a named GTA function instead of returning to a data address where no module owns it.
Test plan
Byte at
0x552343read in a running client right after the hook is installed:Checklist