Custom powerups crash game in GZDoom 3.7 or later

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
d00mtux
Posts: 11
Joined: Tue May 09, 2017 3:34 pm

Custom powerups crash game in GZDoom 3.7 or later

Post by d00mtux »

My game crashes when I'm playing mods that use custom powerup items in the game. I noticed it in GZDoom 3.7 or newer. It doesn't effect 3.6 or older.

Here is the crash log:

VM execution aborted: Invalid class DoomPlayer in function call to PowerArmorOfRegenHeal.StateFunction.2. PowerArmorOfRegenHeal expected
Called from PowerTargeter.InitEffect at gzdoom.pk3:zscript/inventory/powerups.txt, line 1320
Called from PowerTargeter.AttachToOwner at gzdoom.pk3:zscript/inventory/powerups.txt, line 1337
Called from Inventory.TryPickup at gzdoom.pk3:zscript/inventory/inventory.txt, line 491
Called from Inventory.CallTryPickup at gzdoom.pk3:zscript/inventory/inventory.txt, line 595
Called from PowerupGiver.Use at gzdoom.pk3:zscript/inventory/powerups.txt, line 56
Called from Inventory.TryPickup at gzdoom.pk3:zscript/inventory/inventory.txt, line 494
Called from Inventory.CallTryPickup at gzdoom.pk3:zscript/inventory/inventory.txt, line 595
Called from Actor.DoGiveInventory at gzdoom.pk3:zscript/actor_inventory.txt, line 433
Called from Actor.A_GiveInventory at gzdoom.pk3:zscript/actor_inventory.txt, line 448
Called from ArmorOfRegen.StateFunction.2 at test.pk3:decorate, line 23
Called from CustomInventory.Use at gzdoom.pk3:zscript/inventory/stateprovider.txt, line 469
Called from Actor.UseInventory at gzdoom.pk3:zscript/actor_inventory.txt, line 267
Called from PlayerPawn.UseInventory at gzdoom.pk3:zscript/shared/player_inventory.txt, line 219
Called from overlay state PowerArmorOfRegenHeal.2 in PowerArmorOfRegenHeal
Called from PlayerInfo.SetPSprite [Native]
Called from state ArmorOfRegen.2 in inventory state chain in ArmorOfRegen


You can recreate this crash by using an addon I made with the powerup that causes the crash:
Attachments
powerupcrashtest.pk3
Works in GZDoom 3.6. Crashes GZDoom 3.7.1
(491 Bytes) Downloaded 71 times
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Custom powerups crash game in GZDoom 3.7 or later

Post by Graf Zahl »

The problem here is that the Targeter state is being abused in a way the code was never designed for. This state is being run outside its defined actor, which is perfectly harmless as long as it doesn't call any functions.
Any function you call from there is run from the wrong actor class and runs afoul of a necessary run time check to detect genuinely bad definitions that would otherwise result in a hard crash. And that check cannot distinguish between a benign case and the real deal that needs to be guarded against.
Post Reply

Return to “Closed Bugs [GZDoom]”