[Pkg-freeciv-devel] Bug#309046: Segmentation fault when pressing 'G' for go

spikethehobbitmage at excite.com spikethehobbitmage at excite.com
Tue Jan 9 20:39:18 UTC 2007


 Package: freeciv-client-gtk

Version: 2.0.8-3

Description: Segmentation fault when pressing 'G' for go



Problem also exists in freeciv-client-xaw3d 2.0.8-3



I can reproduce this error consistently, so I may be able to help solve it.



The segfault itself is occurring in common/aicore/path_finding.c on line 795 in function create_danger_segment



    /* Step further down the tree */

    ptile = mapstep(ptile, DIR_REVERSE(node->dir_to_here));

    node = &pf_map->lattice[ptile->index];



What is happening is node->dir_to_here has an invalid value (255) so mapstep returns NULL.  ptile->index then segfaults.

I'm not sure why dir_to_here is uninitialized, but I suspect the culprit is in danger_iterate_map.





to reproduce in either client using the attached savegame:

select human player

bomber - space

submarine - space

engineer SE of Huld - scroll right until Tuxpan is visible

	position mouse over mountain SE of Tuxpan (has mine on it)

	type 'G'

Segmentation fault







On a side note, on line 773 it may be better if instead of freeing and then recreating danger_segment if it already exists, you simply skip creating it.



eg:

  if (d_node1->danger_segment == NULL) {

    d_node1->danger_segment = fc_malloc(length * sizeof(struct pf_danger_pos));

  }

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: civgame+2638m.sav.gz
Type: application/x-gzip
Size: 465367 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-freeciv-devel/attachments/20070109/c3d8d889/civgame2638m.sav-0001.bin


More information about the Pkg-freeciv-devel mailing list