Incidencia #48296

Off-by-one error in city_size_add() assert

Abrir Fecha: 2023-06-26 19:42 Última actualización: 2023-07-09 10:05

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
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
  • Propietario Update from (Ninguno) to cazfi
  • Resolución Update from Ninguno to Accepted
Comentario

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 Open to Cerrado
  • Resolución Update from Accepted to Fixed
Comentario

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 » Entrar