Tíquete #48296

Off-by-one error in city_size_add() assert

: 2023-06-26 19:42 Última Atualização: 2023-07-09 10:05

Relator:
Dono:
Tipo:
Estado:
Fechado
Componente:
Marcos:
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Fixed
Arquivo:
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 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
  • Dono Update from (Nenhum) to cazfi
  • Resolução Update from Nenhum to Accepted
Comentário

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
  • Estado Update from Aberto to Fechado
  • Resolução Update from Accepted to Fixed
Comentário

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

Editar

Please login to add comment to this ticket » Login