Project

General

Profile

Actions

Bug #1693

open

SIGSEGV in begin_phase from autoattack loss.

Added by John Robertson 3 months ago. Updated 6 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Server
Target version:
-
Start date:
09/23/2025
Due date:
% Done:

0%

Estimated time:

Description

[3.3.90.5-dev]
During the begin_phase, an autoattack from movement can delete a unit that is later accessed after being freed.

  • Added 'alive' checks after the unit delete to guard against use of deleted pointer.
  • Corrected the return value of adv_follow_path() to return FALSE when the unit had been deleted, instead of returning TRUE, which encouraged use of deleted pointer.
  • Moved the processing for unit_attack_civilian_casualties(), which dereferences the unit pointer ahead of kill_unit() call that deletes the unit.

Files

1693.patch (2.93 KB) 1693.patch John Robertson, 09/23/2025 10:19 AM
1693.v2.patch (4.01 KB) 1693.v2.patch John Robertson, 09/27/2025 05:32 AM
1693.v2.patch (4.19 KB) 1693.v2.patch John Robertson, 12/29/2025 02:46 AM
1693.v3.patch (4.17 KB) 1693.v3.patch John Robertson, 12/29/2025 03:18 AM
Actions #1

Updated by John Robertson 3 months ago

Actions #2

Updated by John Robertson 3 months ago

Found the same issue in the end_phase.

Actions #3

Updated by Marko Lindqvist 3 months ago

  • Target version set to 3.2.2
Actions #4

Updated by Marko Lindqvist 7 days ago

  • Target version deleted (3.2.2)

Sounds like a bugs in adv_unit_execute_path() and unit_survive_autoattack() if you can't rely on their return value to be what it's supposed to be. Fix the issue in its root instead of adding hacky solution to the caller side.

You move around code block and its comment stating "Now that dead defender is certainly no longer listed as unit supported by the city..." ignoring the very comment. In it's new location before collect ransom handling the comment is no longer true, and the code is buggy.

Can you attach a savegame where your original issue can be reproduced?

Actions #5

Updated by John Robertson 6 days ago

Changed to fc_asserts to catch condition and ask for submission of saved games.

Actions #6

Updated by John Robertson 6 days ago

apologies for the confusion, retry on patch.

Actions

Also available in: Atom PDF