URL:
  <http://gna.org/bugs/?14314>

                 Summary: Server segfaults when loading a game
                 Project: Freeciv
            Submitted by: None
            Submitted on: Monday 09/14/2009 at 02:31 CEST
                Category: general
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: goswin-...@web.de
             Open/Closed: Open
                 Release: 
         Discussion Lock: Any
        Operating System: None
         Planned Release: None

    _______________________________________________________

Details:

Hi,

attached is a game with the galactic rules set from the forum and no fog of
war (I think that is causing the segfault). The serve segfaults after (in
maphand.c):

void map_change_seen(struct tile *ptile, struct player *pplayer, int change,
enum vision_layer vlayer)

{
  struct player_tile *plrtile = map_get_player_tile(ptile, pplayer);

The problem is that pplayer->private_map is NULL at this point so the
player_tile returned is 0x420 (just the tile offset) and the access to it a
few lines down segfaults.

I changes the map_get_playe_tile() function to allocate a map when missing
and that stops the segfaults but I'm not sure what side effects that has:

struct player_tile *map_get_player_tile(const struct tile *ptile,
                                        const struct player *pplayer)
{
  if (pplayer->private_map == NULL) {
    freelog(LOG_DEBUG, "map_get_player_tile() called before player has map,
allocating");
    player_map_allocate(pplayer);
  }
  return pplayer->private_map + tile_index(ptile);
}


As a side node, loading a fresh games with zero moves done works fine. But
after a few moves the segfault comes.

MfG
   Goswin




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Monday 09/14/2009 at 02:31 CEST  Name: no-fog.sav.bz2  Size: 29kB   By:
None

<http://gna.org/bugs/download.php?file_id=6698>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?14314>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to