[GRASSLIST:9862] Re: r.mapcalc causing segmentation violation

Markus Neteler neteler at itc.it
Mon Jan 16 17:42:34 EST 2006


Hi Ralf,

we hope that the r.mapcalc developer looks into this asap.
It also crashes for me (apparently a rater new problem).

Markus

On Sun, Jan 15, 2006 at 11:12:51PM +0100, Ralf Gerlich wrote:
> Hi again,
> 
> I have dug a little deeper and realised that it's not the NULL_ROWS, but 
> the fd that is wrong.
> 
> >#1  0xb7f5cd7d in get_null_value_row (fd=0, flags=0x80851f0 "\001\001\001",
> >    row=1, with_mask=1) at get_row.c:1021
> >#2  0xb7f5d35a in get_map_row (fd=0, rast=0x805f360, row=1, data_type=1,
> >    null_is_zero=0, with_mask=1) at get_row.c:1067
> >#3  0x08055b9d in read_row (fd=0, buf=0x805f360 "", row=1, dummy=0)
> >    at map.c:227
> 
> All these have fd=0, which seems odd, as the fd in the source map 
> structure is originally !=0.
> 
> Digging further I found that this happened in column_shift due to 
> missing breaks in the col<0 part. Adding the breaks fixed the crash.
> 
> I have attached the very small patch.
> 
> Best regards,
> Ralf Gerlich

> ? raster/r.mapcalc/OBJ.i486-pc-linux-gnu
> ? raster/r.mapcalc/lex.yy.c
> ? raster/r.mapcalc/y.tab.c
> ? raster/r.mapcalc/y.tab.h
> Index: raster/r.mapcalc/column_shift.c
> ===================================================================
> RCS file: /home/grass/grassrepository/grass6/raster/r.mapcalc/column_shift.c,v
> retrieving revision 2.1
> diff -u -r2.1 column_shift.c
> --- raster/r.mapcalc/column_shift.c	2 Jan 2006 22:23:32 -0000	2.1
> +++ raster/r.mapcalc/column_shift.c	15 Jan 2006 21:52:22 -0000
> @@ -69,6 +69,7 @@
>  
>              for (; i >= 0; i--)
>                  SET_NULL_C(&ibuf[i]);
> +	    break;
>  
>          case FCELL_TYPE:
>              for (i = columns - 1; i >= col; i--) {
> @@ -80,6 +81,7 @@
>  
>              for (; i >= 0; i--)
>                  SET_NULL_F(&fbuf[i]);
> +	    break;
>  
>          case DCELL_TYPE:
>              for (i = columns - 1; i >= col; i--) {
> @@ -91,6 +93,8 @@
>  
>              for (; i >= 0; i--)
>                  SET_NULL_D(&dbuf[i]);
> +	    break;
> +
>          }
>      }
>  }


-- 
Markus Neteler     <neteler itc it>       http://mpa.itc.it
ITC-irst -  Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18        -       38050 Povo (Trento), Italy




More information about the grass-user mailing list