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

Markus Neteler neteler at itc.it
Tue Apr 18 10:56:28 EDT 2006


Harmish Bowman via RT wrote:

>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.
>  
>
I have fixed the allocation problem in r.cost/main.c.

Markus




More information about the grass-dev mailing list