[GRASS5] [bug #1502] (grass) r.mapcalc error

Glynn Clements glynn.clements at virgin.net
Tue Jan 14 08:55:12 EST 2003


Markus Neteler wrote:

> > > The command crashing is:
> > > 
> > > r.mapcalc "test=@census1994dryUTM34S"
> > > 6%
> > > Segmentation fault
> > > 
> > > Thanks for looking into this. The map was imported with r.in.shape.
> > 
> > OK. The segfault occurs when G_get_cat() is called for an invalid
> > category (in this case 0; the cats table starts at 1).
> 
> Excuse me, but this is not clear to me. The cats file starts with
> 1:0.0000
> Do you mean that 0.0000 is invalid?

No; requesting the label for category zero is invalid.

> > There are a variety of possible fixes.
> > 
> > 1. Change G_quant_get_cell_value() to handle the case where
> > G__quant_get_rule_for_d_raster_val() returns NULL. I'm not sure what
> > it should return in this case (although it shouldn't segfault). In
> > this particular case (r.mapcalc) it shouldn't actually matter what was
> > returned, as the value should never actually be used.

Actually, returning null should be OK. This would seem to be the
simplest (and most efficient) solution.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list