Skip to content

fix: Prevent ThingTemplate::parseModuleName null dereference crash - #543

Open
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/thingtemplate-parsemodulename-crash
Open

fix: Prevent ThingTemplate::parseModuleName null dereference crash#543
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/thingtemplate-parsemodulename-crash

Conversation

@seer-by-sentry

@seer-by-sentry seer-by-sentry Bot commented Aug 1, 2026

Copy link
Copy Markdown

This PR addresses CLIENT-317 by adding a null-check after the call to TheModuleFactory->newModuleDataFromINI() within ThingTemplate::parseModuleName.

Previously, if newModuleDataFromINI() returned a nullptr (indicating an unknown module name referenced in an INI file), the subsequent dereference of this null pointer (data->isAiModuleData()) would lead to a fatal EXCEPTION_ACCESS_VIOLATION_READ crash.

The fix introduces a check for nullptr and, if detected, triggers a DEBUG_CRASH with relevant context and throws INI_INVALID_DATA, allowing for a graceful failure during INI parsing instead of a hard crash. This change was applied to both Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp and GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp.

This issue was previously identified and fixes were attempted in PRs #353 and #433, but these were never merged.

Fixes CLIENT-317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants