[GRASS-user] bug in r.pi.nlm add-on module
Hamish
hamish_b at yahoo.com
Wed Feb 1 17:06:49 EST 2012
Martin Wegmann wrote:
> > I encountered a bug in an add-on module, r.pi.nlm
> ...
> > (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.
I notice MinMax() in func.c starts its for loop
at i=1 instead of 0, perhaps that is a bug?
Hamish
More information about the grass-user
mailing list