[GRASS5] r.texture segfault
Hamish
hamish_nospam at yahoo.com
Thu Jun 30 01:26:32 EDT 2005
> we found a bug in r.texture which I'm unable to resolve.
>
> To reproduce it in Spearfish, run
>
> g.region rast=spot.image -p
> r.rescale spot.image to=0,255 out=spot.resc
> r.texture in=spot.resc -v pref=spot.image size=10 distance=5
> Segmentation fault
>
> I found with the debugger following
>
> (gdb) r in=spot.resc -v pref=spot.image size=10 distance=5
> Starting program: /hardmnt/thuille0/ssi/software/cvsgrass61/dist.i686-pc-linux-gnu/bin/r.texture in=spot.resc -v pref=spot.image size=10 distance=5
> Reading the raster map...done
> 0%
> Program received signal SIGSEGV, Segmentation fault.
> 0x08049574 in h_measure (grays=0x87798e0, rows=10, cols=10, t_m=12, t_d=5)
> at h_measure.c:124
> 124 while (tone[y] != grays[row][col + d])
> (gdb) bt
> #0 0x08049574 in h_measure (grays=0x87798e0, rows=10, cols=10, t_m=12, t_d=5)
> at h_measure.c:124
> #1 0x0804d657 in main (argc=6, argv=0xbfe19214) at main.c:309
>
>
> The 'ddd' tells me that tone[y] is unavailable. Probably y get's
> too large and then the crash occurs.
>
> How to fix this?
a full back trace should show the value of y when it segfaults:
(gdb) bt full
r.texture/h_measure.c:
#define PGM_MAXMAXVAL 255
int tone[PGM_MAXMAXVAL];
That 255 should really be 256?
int tone[255];
allocates tone[0] -> tone[254], maybe it loops up the value of y trying
to match a grey value of 255 and then kerplunk?
Hamish
More information about the grass-dev
mailing list