Project

General

Profile

Bug #707912

Mapimg crash with high number of players

Added by Marko Lindqvist over 1 year ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Category:
General
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

img_save_magickwand() crashed to division by zero.

First, in line 2152 (in master) assigns zero to plrwidth (map_width = 387, player_slot_count() = 512, integer math):
plrwidth = map_width / player_slot_count();

Then, at line 2165 there's division by plrwidth:
i = (x - plroffset) / plrwidth;

mapimg_bugfix.patch (579 Bytes) mapimg_bugfix.patch Andreas Røsdal, 2017-12-17 07:18 AM

History

#1 Updated by Andreas Røsdal over 1 year ago

Patch attached.

#2 Updated by Marko Lindqvist over 1 year ago

  • Target version set to 3.1.0

#3 Updated by Marko Lindqvist over 1 year ago

Have you checked that the negative plroffset value, that is possible with the patch, is not a problem?

#4 Updated by Andreas Røsdal over 1 year ago

No, not checked that.

#5 Updated by Chad McHenry 7 months ago

A pull request to address this has been submitted to Github: https://github.com/freeciv/freeciv/pull/14

#6 Updated by Marko Lindqvist 7 months ago

  • Status changed from In Progress to Resolved
  • Assignee deleted (Andreas Røsdal)
  • Target version changed from 3.1.0 to 2.6.1

While the problem is more likely to occur in master where max number of players (barbarians included) is 512, it can happen in older branches with smaller displays -> retargeting to S2_6.

#7 Updated by Marko Lindqvist 7 months ago

  • Status changed from Resolved to Closed
  • Assignee set to Marko Lindqvist

Also available in: Atom PDF