[Freeciv-Dev] Re: normalize_map_pos and invalid map positions
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Fri, Aug 09, 2002 at 11:02:44PM +0000, Per I. Mathisen wrote:
I will leave the other "uninteresting"/easy questions to Jason ;)
> > The problem comes in when we consider worst-case scenarios.Suppose a
> > particular piece of code does not correctly normalize the coordinates
> > before passing them in.Usually we could just normalize them and be
> > done with it, but in this case that's dangerous.If (-1,-1) is passed
> > in we cannot tell if we should normalize or treat it as a special case.
> Just make a strict policy and interface, then enforce it? For each data
> structure, designate whether it will contain normalized or raw
> coordinates. The latter I would think should only be generated in a very
> few places in the code. Or am I wrong?
Yes. Unreal map positions are removed/skipped immediately. The
remaining ones are normalized. So almost all of the code only works on
normal positions. There are no guards except at the bottom:
CHECK_MAP_POS at map_get_tile and co.
> > And what if (-2,-2) is passed in?
>
> If we encounter that in a piece of data where coords should be normalized,
> then obviously we should assert and die (or freelog and return). No?
Or ignore the packet. See also CHECK_MAP_POS (which got disabled some
weeks ago in non-debug mode (you should enable it if you make the
goto_dest_ changes)).
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Using only the operating-system that came with your computer is just
like only playing the demo-disc that came with your CD-player."
- [Freeciv-Dev] normalize_map_pos and invalid map positions, Per I. Mathisen, 2002/08/09
- [Freeciv-Dev] Re: normalize_map_pos and invalid map positions, Mike Kaufman, 2002/08/09
- [Freeciv-Dev] Re: normalize_map_pos and invalid map positions, Ross W. Wetmore, 2002/08/13
- [Freeciv-Dev] Re: normalize_map_pos and invalid map positions, Jason Short, 2002/08/14
- [Freeciv-Dev] Re: normalize_map_pos and invalid map positions, Per I. Mathisen, 2002/08/15
- [Freeciv-Dev] Re: normalize_map_pos and invalid map positions, Jason Short, 2002/08/15
- [Freeciv-Dev] Re: normalize_map_pos and invalid map positions, Raimar Falke, 2002/08/15
- [Freeciv-Dev] Re: normalize_map_pos and invalid map positions, Jason Short, 2002/08/15
- [Freeciv-Dev] Re: normalize_map_pos and invalid map positions, Ross W. Wetmore, 2002/08/22
- Message not available
- [Freeciv-Dev] Re: normalize_map_pos and invalid map positions, Ross W. Wetmore, 2002/08/22
|
|