VM Abort: Address Zero in gzdoom.pk3

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.
User avatar
stainedofmind
Posts: 197
Joined: Sun Sep 01, 2019 10:59 am

VM Abort: Address Zero in gzdoom.pk3

Post by stainedofmind »

Ran into a VM Abort: Tried to read from address zero while testing some mods, and while I'm certain it was one of the mods that caused the issue, it only opened the door to allow this error to happen, specifically, on line 256, "target" is not being check for existence before being used.

Screenshot of error:
User avatar
Marisa the Magician
Banned User
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: VM Abort: Address Zero in gzdoom.pk3

Post by Marisa the Magician »

I think I've tracked down the potential source of the problem:

Code: Select all

AActor *P_SpawnSubMissile(AActor *source, PClassActor *type, AActor *target)
{
	AActor *other = Spawn(source->Level, type, source->Pos(), ALLOW_REPLACE);

	if (source == nullptr || type == nullptr)
	{
		return nullptr;
	}

	other->target = target;
	other->Angles.Yaw = source->Angles.Yaw;
	other->VelFromAngle();

	if (other->flags4 & MF4_SPECTRAL)
	{
		if (source->flags & MF_MISSILE && source->flags4 & MF4_SPECTRAL)
		{
			other->FriendPlayer = source->FriendPlayer;
		}
		else
		{
			other->SetFriendPlayer(target->player);
		}
	}

	if (P_CheckMissileSpawn(other, source->radius))
	{
		DAngle pitch = P_AimLineAttack(source, source->Angles.Yaw, 1024.);
		other->Vel.Z = -other->Speed * pitch.Sin();
		return other;
	}
	return NULL;
}
P_SpawnSubMissile doesn't seem to have a null check for target before that call to SetFriendPlayer
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: VM Abort: Address Zero in gzdoom.pk3

Post by Graf Zahl »

fixed

Return to “Closed Bugs [GZDoom]”