Project

General

Profile

Actions

Bug #2451

open

dai_unit_attack() dereferences a stale bodyguard pointer after the attack

Added by Sweet Tea Dorminy about 19 hours ago. Updated about 12 hours ago.

Status:
In Review
Priority:
Normal
Category:
AI
Target version:
Start date:
11/08/2026
Due date:
% Done:

0%

Estimated time:

Description

dai_unit_attack() reads the attacker's bodyguard with aiguard_guard_of() before unit_do_action(), and dereferences the pointer afterwards, checking only that the attacker itself survived. However, the action can remove the bodyguard too in civil war. The server then segfaults at the def_ai_unit_data(bodyguard) read.

Patch stores the bodyguard ID and looks up by ID after action, since that's safe.


Files

Actions

Also available in: Atom PDF