[CF-Devel] Some bug fixes
crossfire-devel at archives.real-time.com
crossfire-devel at archives.real-time.com
Tue Mar 2 01:02:49 CST 2004
Andreas Kirschbaum wrote:
>
Hi,
>
>
I'd like to present some bug fixes for the server. (I'll commit them if
>
there are no objections.) The patches correct some out of bounds
>
accesses to arrays that occurred on my local server.
>
>
For the first patch (patch-1.diff), I do not have any specific item to
>
reproduce the bug but it occurred frequently that "enc > 20".
Looks fine.
>
>
The loops in patch-2.diff run one too far, especially for (client) map
>
size 25x25: in this case the loops run from -1 to 25 (inclusive).
I'd double check that logic if that change still works properly if the player
chooses an even map size (eg, 20x20). Granted, that it is a little odd in that
the player won't be centered, but I recall some odd issues there.
Alternative would only be to allow odd map sizes or the like.
>
>
The patch patch-3.diff fixes two out of range errors in lines 737+ and
>
1061+. The remaining changes replace the sizeof-expressions with the
>
macro "arraysize". Is this change acceptable or should I correct the
>
bugs only? Maybe the macro should go into a header file (which one?)
>
because there are some other places (server/commands.c,
>
server/alchemy.c, ...) where it could be used.
If not seen any problems here, so I'm not positive what that change is fixing.
>
>
patch-4.diff fixes some invalid array references when no free spot can
>
be found. (Only the first one in treasure.c did actually crash.) I don't
>
think, the fixes for the exit (and maybe the key) are very good because
>
they drop the exit or place the key in an invalid place.
Hard to say - in some cases, it can be better to just crash, because at least
that allows easier investigation on what caused the problem.
>
>
The bug in patch-5.diff did happen in /pup_land/nurnberg/dick/bomb1 with
>
the first titan (it has Str=60). For me, this patch is not yet ready for
>
inclusion because similar problems exist for dex_bonus[] and maybe other
>
xxx_bonus[]. My preferred solution is to create new functions to
>
calculate the bonus. These functions can take care for the correct index
>
values.
Well, one solution is to just extend the tables themselves (str_bonus, etc).
And in fact, that is probably the best solution, because it keeps it simple
(same code for both monsters & characters).
Probably still important to have a max_player_stat vs just a max_stat.
_______________________________________________
crossfire-devel mailing list
crossfire-devel at lists.real-time.com
https://mailman.real-time.com/mailman/listinfo/crossfire-devel
More information about the crossfire
mailing list