Complete.Org: Mailing Lists: Archives: freeciv-ai: October 2003:
[freeciv-ai] Re: (PR#6236) uninitialized citymap value
Home

[freeciv-ai] Re: (PR#6236) uninitialized citymap value

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [freeciv-ai] Re: (PR#6236) uninitialized citymap value
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Wed, 22 Oct 2003 00:28:12 -0700
Reply-to: rt@xxxxxxxxxxxxxx

> Per I. Mathisen wrote:
> > On Sun, 21 Sep 2003, Jason Short wrote:
> > 
> >>>Valgrind gives this fairly often for the server:
> >>>==13287==  at 0x8067A58: auto_arrange_workers (cityturn.c:235)
> > 
> > ...
> > 
> >>>Could relate to PR#6222, but I doubt it (this is just an invalid read).
> >>>This may have been reported before. We really need to fix it.
> >>
> >>The culprit is the worker_positions_used field. In the client this is
> >>memset to 0 before it is used. In the server it's not.
> > 
> > 
> > I don't see why it should be. cm_query_result() shouldn't give us a
> > cm_result struct with unset data in it. So the bug must be in CM.
> > 
> > I looked at this briefly but found nothing. Raimar?
> 
> my_city_map_iterate skips the center tile.

> -  my_city_map_iterate(pcity, x, y) {
> +  city_map_checked_iterate(pcity->x, pcity->y, x, y, mx, my) {
>      result->worker_positions_used[x][y] =
>       (base_combination->worker_positions[x][y] == C_TILE_WORKER);
> -  } my_city_map_iterate_end;
> +  } city_map_checked_iterate_end;

Sorry but this patch is plain wrong. worker_positions is never set for
the center tile. You did have luck that the warning vanished and no
new warning surfaced. I will revert the patch.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Microsoft DNS service terminates abnormally when it recieves a response
  to a DNS query that was never made.
  Fix Information: Run your DNS service on a different platform."
    -- MS service information on bugtraq



[Prev in Thread] Current Thread [Next in Thread]