Skip to content

Conversation

@xezon
Copy link

@xezon xezon commented May 31, 2025

This change fixes a game crash in AIGroup::friend_moveFormationToPos(). The repro steps are undisclosed due its severity.

I looked at all other movement functions in AIGroup and they already test AIUpdateInterface correctly.

Callstack

 	[Inline Frame] generalszh.exe!AICommandInterface::aiMoveToPosition(const Coord3D *) Line 472	C++
 	generalszh.exe!AIGroup::friend_moveFormationToPos(const Coord3D * pos, CommandSourceType cmdSource) Line 1131	C++
 	generalszh.exe!AIGroup::groupMoveToPosition(const Coord3D * p_posIn, bool addWaypoint, CommandSourceType cmdSource) Line 1639	C++
>	generalszh.exe!GameLogic::logicMessageDispatcher(GameMessage * msg, void * userData) Line 1995	C++
 	generalszh.exe!GameLogic::processCommandList(CommandList * list) Line 2591	C++
 	generalszh.exe!GameLogic::update() Line 3761	C++
 	generalszh.exe!Win32GameEngine::update() Line 93	C++
 	generalszh.exe!GameEngine::execute() Line 819	C++
 	generalszh.exe!GameMain(int argc, char * * argv) Line 47	C++
 	generalszh.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 988	C++
 	[Inline Frame] generalszh.exe!invoke_main() Line 102	C++
 	generalszh.exe!__scrt_common_main_seh() Line 288	C++
 	kernel32.dll!7598fcc9()	Unknown
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	ntdll.dll!772e82ae()	Unknown
 	ntdll.dll!772e827e()	Unknown
Exception thrown at 0x010B3B58 in generalszh.exe: 0xC0000005: Access violation reading location 0x00000020.

@xezon xezon added this to the Stability fixes milestone May 31, 2025
@xezon xezon added Bug Something is not working right, typically is user facing Critical Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Crash This is a crash, very bad labels May 31, 2025
@Mauller
Copy link

Mauller commented May 31, 2025

Had a quick look and a few functions like AIGroup::friend_moveInfantryToPos and AIGroup::friend_moveVehicleToPos don't test for null on the ai interface.

@xezon
Copy link
Author

xezon commented May 31, 2025

Had a quick look and a few functions like AIGroup::friend_moveInfantryToPos and AIGroup::friend_moveVehicleToPos don't test for null on the ai interface.

They do. In the top loop.

@Mauller
Copy link

Mauller commented May 31, 2025

Had a quick look and a few functions like AIGroup::friend_moveInfantryToPos and AIGroup::friend_moveVehicleToPos don't test for null on the ai interface.

They do. In the top loop.

Oh i see it now, they were doing this (*i)->getAI()==NULL when i was expecting this AIUpdateInterface *ai = theUnit->getAIUpdateInterface(); like in the second loop.

Copy link

@Mauller Mauller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as intended, i also have a VC6 compatible replay to test this.

@xezon xezon merged commit 2940669 into TheSuperHackers:main Jun 6, 2025
19 checks passed
@xezon xezon deleted the xezon/fix-formation-crash branch June 6, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Crash This is a crash, very bad Critical Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Game crashes when moving units

3 participants