Repository navigation
GGPO: fix heap corruption at session end in the Clang Release build - #803
Merged
Merged
Conversation
…lete[] freed the wrong pointer at session end Co-Authored-By: Claude Opus 5.5 <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.
Description of Changes
Peer2PeerBackendnow constructs and destroys itsUdpProtocolendpoint array by hand (operator new, placement new, explicit destructor calls,operator delete) instead ofnew[]/delete[].Rationale behind Changes
v1.1.0 (CI, Clang) crashes with
STATUS_HEAP_CORRUPTIONinggpo_close_sessionwhen a GGPO battle ends.UdpProtocolhas a virtual destructor, sodelete[]goes through the vtable's deleting destructor with the array flag; the Clang build's vtable entry is the scalar one, which ignores that flag and freesthis, 8 bytes past the allocation's array cookie. Page heap on the Release build stops there with "corrupted start stamp". The MSVC Devel build does not show it.Suggested Testing Steps
Did you use AI to help find, test, or implement this issue or feature?
Yes: Claude Code read the crash report and minidump, disassembled the Release build to find the cause, and wrote the fix.
🤖 Generated with Claude Code