Custom powerups crash game in GZDoom 3.7 or later

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Custom powerups crash game in GZDoom 3.7 or later

Re: Custom powerups crash game in GZDoom 3.7 or later

by Graf Zahl » Fri Jan 11, 2019 12:58 pm

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.

Custom powerups crash game in GZDoom 3.7 or later

by d00mtux » Fri Jan 11, 2019 12:31 pm

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 70 times

Top