[GRASS-user] bug in r.pi.nlm add-on module

Hamish hamish_b at yahoo.com
Wed Feb 1 14:24:28 EST 2012


Martin Wegmann wrote:
> I encountered a bug in an add-on module, r.pi.nlm 
...
> P.S.: r.pi.nlm is generating a random fractal
> landscape either based on an input map or by
> defining the percentage cover (0-100%) and 
> sharpness/agglomeration (0-1) factor.

see also:
http://grass.osgeo.org/wiki/Quick_wx_tutorial#Create_a_random_surface

Add a mountain created from the r.surf.volcano addon
module to the random surface with r.mapcalc for
an interesting scene.


> r.pi.nlm input=landuse96_28m keyval=4 output=nlm1
...
> Markus error log with gdb:
> 
> 
> (gdb) r.pi.nlm input=landclass96 keyval=5 output=test --o
> Starting program:
...
> Program received signal SIGSEGV, Segmentation fault.
...
> (gdb) bt full
...
>         min = 1000000
>         max = 1000000
>         span = 0
...
>         index = -2147483648
...
> in func.c:
...
>     span = max - min;
>     c = min / span;
...
>         index = floor(RESOLUTION *
> (map[i] - min) / span);
>         ^^^^^^--- negative
> 
>     Then the subsequent values[index] crashes.


min=max so span=0. the resulting divide by 0
causes the index to go to infinity.


Hamish


More information about the grass-user mailing list