[GRASS5] [bug #4286] (grass) r.cost and r.walk will not work with vector start points

Harmish Bowman via RT grass-bugs at intevation.de
Mon Apr 17 23:35:42 EDT 2006


r.cost segfaults with a vector point input map, but only if that input map has
attributes.

e.g. if you just make a points map:
echo "x|y" | v.in.ascii [-t]

it works ok.

Speafish example where it fails:
  r.cost in=elevation.dem out=tmp_segflt start_points=bugsites


problem:
r.cost/main.c line 472 doesn't allocate room for any attributes (the end ,0,0)
   site = G_site_new_struct(-1, 2, 0, 0);

but the G_site_get() two lines later will try and copy any attributes into the
site structure. Result: segmentation fault on this line of lib/sites/sites.c

   G_strncpy (s->str_att[i], sa->str[i], MAX_SITE_STRING);



a fix:
scan the sites and allocate enough memory.

a better fix:
update module to have it use the new vector API.



Hamish

ps - I've just done a cleanup on the r.cost help page, including a new figure
showing the effect of using the knight's move. Can anybody tell me if the
ending/starting text is reversed in the EXAMPLE section? (see html source
comments)


-------------------------------------------- Managed by Request Tracker




More information about the grass-dev mailing list