Strange access violation crash in GZDoom (version 4.2.4)...

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: Strange access violation crash in GZDoom (version 4.2.4)...

Re: Strange access violation crash in GZDoom (version 4.2.4)

by _mental_ » Fri Nov 22, 2019 12:08 am

DoomKrakken wrote:I wonder why it happened in so few places, and didn't crash that often.
That’s the nature of a random memory overwrite. Depending on particular situation, it can be very easy to trigger a visible bug or may go unnoticed for years.

Re: Strange access violation crash in GZDoom (version 4.2.4)

by DoomKrakken » Thu Nov 21, 2019 10:33 pm

AWESOME!

Ah, so it had to do with the porting of speed counters over to ZScript, with an improper pointer.

Well, this will certainly help! Just fixed it, and now there are no crashes (thus far, but I'm confident I fixed it well).

I wonder why it happened in so few places, and didn't crash that often.

Thanks so much for your help! :D

Re: Strange access violation crash in GZDoom (version 4.2.4)

by _mental_ » Thu Nov 21, 2019 9:02 am

Missing checks are fixed in cf8c05c. This means that code with such issues will fail to compile.
Spoiler: Errors reported with this fix

Re: Strange access violation crash in GZDoom (version 4.2.4)

by _mental_ » Thu Nov 21, 2019 4:14 am

EOA Code.pk3:ZScript/EOA/Base.txt

Code: Select all

Class EOA_BaseWeapon : DoomWeapon
{
	// ...
	Int SpeedCounter;
	// ...
	Void SetSpeedCounter(Int Amount)
	{
		SpeedCounter = Amount;
	}
	// ...
EOA Code.pk3:Decorate/Weapons/Chaingun.txt

Code: Select all

ACTOR EOA_Chaingun : EOA_Weapon 20008
{
	// ...
	States
	{
		// ...
	SpinAnim1:
		// ...
		"####" ABC 1
		{
			// ...
			SetSpeedCounter(0);
			// ...
The thing is self inside SetSpeedCounter() function will point to a player object and not to a weapon one.
Your mod is so lucky that the given member overwrites the lower half of dynamic array's internal pointer (for 64-bit version).
No surprise that this will crash the game sooner or later.

Engine should reject such code, and it does so for ZScript classes. A mix of Decorate and ZScript lacks such checks at the moment.

Re: Strange access violation crash in GZDoom (version 4.2.4)

by DoomKrakken » Wed Nov 20, 2019 10:37 am

Alright, I will.

Shouldn't take long to play, if I also give you my save file. You'll spawn right in front of the Haste item, and you'll turn around and find that alcove past the Spider Mastermind and some permanent homing items. ;)

Re: Strange access violation crash in GZDoom (version 4.2.4)

by _mental_ » Wed Nov 20, 2019 3:56 am

It depends on how much time I need to play in order to trigger the crash. Actually, you can PM me anyway, as I can try to change garbage collection setting in order to reproduce it faster.

Re: Strange access violation crash in GZDoom (version 4.2.4)

by DoomKrakken » Wed Nov 20, 2019 3:42 am

I can PM you my mod, would you like that?

Also, you'll need to get joi_lstcv14.wad from here: https://www.doomworld.com/forum/topic/1 ... load-link/

Re: Strange access violation crash in GZDoom (version 4.2.4)

by _mental_ » Wed Nov 20, 2019 2:50 am

Maybe with full memory dump it would be possible to figure out something. Minidump is mostly useless here.
In order to fix this, we need a reliable way to reproduce the problem.
Spoiler: Callstack

Strange access violation crash in GZDoom (version 4.2.4)...

by DoomKrakken » Wed Nov 20, 2019 2:01 am

Not sure how to explain it, but it continues to happen occasionally in a mod I'm developing called "Embers Of Armageddon" (which attempts to faithfully recreate the weapons, items, combat mechanics, and upgrade systems of DOOM to Doom via GZDoom). It typically happens while a Haste powerup is active (doesn't seem to happen with other powerups in the mod, for whatever reason) while firing the Chaingun in certain areas (although sometimes it also happens just by spinning the Chaingun using the Gatling Rotator). It's a very rare bug, and doesn't always happen, so it's hard to find any place to recreate it.

The most recent place this bug occurred was in MAP12: Suburb in "Lost Civilization" by Jaska (joi_lstcv14.wad).

Here are some screenshots (had to upload them to some channel in Discord so that they can be viewed here):

The Haste item:
https://cdn.discordapp.com/attachments/ ... 231327.png

Firing the Chaingun into the alcove where the problem seems to occur:
https://cdn.discordapp.com/attachments/ ... 004252.png

Haste active:
https://cdn.discordapp.com/attachments/ ... 004305.png

I will PM you my mod upon request (please don't distribute).

I've also attached the crash report here.

What seems to be the problem? Will you need anything more from me?

Thank you for your time.
Attachments
CrashReport.zip
I have four others like this in my GZDoom folder.
(92.79 KiB) Downloaded 33 times

Top