Custom powerups crash game in GZDoom 3.7 or later

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

Custom powerups crash game in GZDoom 3.7 or later

Postby d00mtux » Fri Jan 11, 2019 1: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 9 times
d00mtux
 
Joined: 09 May 2017

Re: Custom powerups crash game in GZDoom 3.7 or later

Postby Graf Zahl » Fri Jan 11, 2019 1: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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest