[GRASS5] Stars and stripes in raster maps: segfault

Glynn Clements glynn at gclements.plus.com
Fri Aug 26 21:12:33 EDT 2005


Markus Neteler wrote:

> today we discovered a severe problem in the internal raster resampling
> routine. We copied a map (XY location) at lower resolution with r.mapcalc,
> the result was a damaged map which crashes various modules.

> Using ddd I identified the crash in libgis at:
> static int close_old (int fd)
> ...
>   free (FCB.data);  <- crash

If a heap block gets corrupted at some point, it usually manifests
itself when you call free.

The code with the bug won't necessarily be accessing the block which
is corrupted; it could be writing beyond the end of the previous block
and overwriting the header at the start of the block in question.

Often the simplest way to detect such problems is to manually link the
executable against libmcheck and to call mprobe() on the block in
question at regular intervals. The corruption will be occuring between
the last call to mprobe() which succeeded and the first call which
failed.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list