[GRASS-dev] Re: r.external

Glynn Clements glynn at gclements.plus.com
Thu Sep 18 08:54:40 EDT 2008


Markus Neteler wrote:

> >> using the DTM map registered with r.external, I get sometimes (not sure on
> >> what it depends), a Segmentation fault:
> >
> >> Program received signal SIGSEGV, Segmentation fault.
> >> [Switching to Thread 47745198216448 (LWP 24661)]
> >> 0x00002b6c8556ebcb in free () from /lib64/libc.so.6
> >> (gdb) bt
> >> #0  0x00002b6c8556ebcb in free () from /lib64/libc.so.6
> >> #1  0x00002b6c83f0c09b in G_free (buf=0x7c7c668c) at alloc.c:130
> >> #2  0x00002b6c83f112e5 in close_old (fd=8) at closecell.c:144
> >
> > 143         if (fcb->cellhd.compressed)
> > 144             G_free(fcb->row_ptr);
> >
> > The compressed field should always be zero.
> >
> > r.external should always set it to zero in the cellhd file, and for a
> > map opened for read, the cellhd structure should contain exactly what
> > is in the file.
> 
> This seems to be the case:
> 
> [neteler at fep grassdata]$ cd patUTM32/PERMANENT/cellhd/
> [neteler at fep cellhd]$ cat pat_DTM_5m
> proj:       1
> zone:       32
> north:      5157086
> south:      5059541
> east:       730098
> west:       612488
> cols:       23522
> rows:       19509
> e-w resol:  5
> n-s resol:  5
> format:     -1
> compressed: 0

So it appears that something is modifying fcb->cellhd.compressed.

But I have no idea what. For an input map, nothing explicitly modifies
that field after the structure has been read from the file, and I
can't see any plausible memory corruption scenario.

d.rast should only have a single raster open, so the preceding
G__.fileinfo[] slots should be unused (AFAICT, the fact that it's
getting fd=8 is due to additional descriptors used by gdb).

The only array in "struct fileinfo" is NULL_ROWS, but if the map is a
GDAL link, the only code which modifies that uses
"for (i = 0; i < NULL_ROWS_INMEM; i++)", so it can't overflow the
array.

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


More information about the grass-dev mailing list