<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40319 >

Seems this IS bringing to light a major bug: game_renumber_players is 
being called and dropping the number of players below 0 in the client.

This patch adds a very valid assert.  It triggers when following the 
previous instructions.  This means random pieces of memory are being 
overwritten (and were before the recent patch, though now it's more 
being overwritten) which will cause random bugs.  It won't trigger a 
valgrind error as long as the memory is valid though (likely it's 
somewhere in the game structure up above game.players).

-jason


Index: common/game.c
===================================================================
--- common/game.c	(revision 14869)
+++ common/game.c	(working copy)
@@ -495,6 +495,7 @@
   }
 
   game.nplayers--;
+  assert(game.nplayers >= 0);
 
   /* Reset player structure. */
   player_init(&game.players[game.nplayers]);
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to