Conversation
Owner
|
Thanks for the contribution. I'd just like to know how you encountered this crash. What did you do in-game to trigger it? The changelog should refer to that and say something like "Fix possible crash when ___" instead of describing the changes made to the code, which are not meaningful for users. |
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.
Fixes a recurring
0xC0000005crash (EIP0x000002DF, a virtual call through a NULL vtable) triggered whenpatch_City_has_improvement()is invoked with a NULLCity*.Root cause
patch_City_has_improvement()unconditionally forwarded to the game's virtualCity_has_improvement(). With a NULLthis, the vtable dispatch executedcall [NULL + 0x2DF], faulting on the read at0x2DF.Confirmed by disassembling the faulting wrapper in a full crash dump: the instruction sequence at the wrapper entry matched this function exactly (the
share_wonders_in_hotseatbranch, thethis->Body.CivIDreads, thep_human_player_bitsmask, and the player-bits loop all line up instruction-for-instruction).Fix
Added a guard at the top of the function returning
false:This is safe because all call sites consume the return value only in boolean context, and the code already NULL-guards this exact call elsewhere:
Notes
.c3xtxtsection, and thatinjected_code.ccompiles cleanly via the repo'sTEST_INJECTED_CODE_COMPILE.bat.