Ticket #48296

Off-by-one error in city_size_add() assert

오픈 날짜: 2023-06-26 19:42 마지막 업데이트: 2023-07-09 10:05

Reporter:
소유자:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
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
  • 소유자 Update from (None) to cazfi
  • Resolution Update from None to Accepted
댓글 올리기

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
  • Status Update from Open to Closed
  • Resolution Update from Accepted to Fixed
댓글 올리기

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

Edit

Please login to add comment to this ticket » Login