Ticket #48296

Off-by-one error in city_size_add() assert

Eröffnet am: 2023-06-26 19:42 Letztes Update: 2023-07-09 10:05

Auswertung:
Verantwortlicher:
Typ:
Status:
Geschlossen
Komponente:
Meilenstein:
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
2

Details

city_size_add():

fc_assert_ret(MAX_CITY_SIZE - size > add);
When city is already size 254, and one would add the final citizen, this fails (255 - 254 is not GREATER than 1)

Ticket-Verlauf (3/5 Historien)

2023-06-26 19:42 Aktualisiert von: cazfi
  • New Ticket "Off-by-one error in city_size_add() assert" created
2023-06-28 06:48 Aktualisiert von: cazfi
  • Verantwortlicher Update from (Keine) to cazfi
  • Lösung Update from Keine to Accepted
Kommentar

Patches for all branches, including S2_6, attached.

Both patches relax overzealous asserts. Main/S3_2 one also makes another assert more strict - do not allow reducing city size to zero on server side (such a city shouldn't exist at all).

2023-07-09 10:05 Aktualisiert von: cazfi
  • Status Update from Offen to Geschlossen
  • Lösung Update from Accepted to Gefixt
Kommentar

Patches for all branches, including S2_6, attached.

Both patches relax overzealous asserts. Main/S3_2 one also makes another assert more strict - do not allow reducing city size to zero on server side (such a city shouldn't exist at all).

Dateianhangliste

Bearbeiten

Please login to add comment to this ticket » Anmelden