Ticket #48296

Off-by-one error in city_size_add() assert

Date d'ouverture: 2023-06-26 19:42 Dernière mise à jour: 2023-07-09 10:05

Rapporteur:
Propriétaire:
Type:
État:
Atteints
Composant:
Priorité:
5 - moyen
Sévérité:
5 - moyen
Résolution:
Fixed
Fichier:
2

Détails

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 History (3/5 Histories)

2023-06-26 19:42 Updated by: cazfi
  • New Ticket "Off-by-one error in city_size_add() assert" created
2023-06-28 06:48 Updated by: cazfi
  • Propriétaire Update from (Aucun) to cazfi
  • Résolution Update from Aucun to Accepted
Commentaire

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 Updated by: cazfi
  • État Update from Ouvert to Atteints
  • Résolution Update from Accepted to Fixed
Commentaire

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).

Attachment File List

Modifier

Please login to add comment to this ticket » Connexion