#44449: count_ *_near_tile() theoretical division by zero Open Date: 2022-04-24 01:52 Last Update: 2022-04-24 13:28 URL for this Ticket: https://osdn.net//projects/freeciv/ticket/44449 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=44449 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2022-04-24 13:28 Updated by: cazfi * Owner Update from (None) to cazfi * Resolution Update from None to Accepted * Milestone Update from (None) to 3.0.2 --------------------------------------------------------------------- Ticket Status: Reporter: cazfi Owner: cazfi Type: Bugs Status: Open [Owner assigned] Priority: 5 - Medium MileStone: 3.0.2 Component: General Severity: 5 - Medium Resolution: Accepted --------------------------------------------------------------------- Ticket details: Clang static analyzer complains about a number of count_*_near_tile() functions that first iterate adjacent tiles, and count them in the process, and then use that total as a divider. While the iteration can go over less-than-number-of-directions tiles when on the edge of the world, it would result in zero only for a single tile world. So this is more about silencing the report than fixing an actual bug. -- Ticket information of Freeciv project Freeciv Project is hosted on OSDN Project URL: https://osdn.net/projects/freeciv/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/freeciv/ticket/44449 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=44449