[GRASS-dev] [GRASS GIS] #474: r.quantile: segfaults with
percentile=100
GRASS GIS
trac at osgeo.org
Tue Feb 3 18:04:55 EST 2009
#474: r.quantile: segfaults with percentile=100
------------------------+---------------------------------------------------
Reporter: hamish | Owner: grass-dev at lists.osgeo.org
Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Raster | Version: svn-develbranch6
Keywords: r.quantile | Platform: Linux
Cpu: x86-32 |
------------------------+---------------------------------------------------
spearfish:
{{{
g.region rast=elevation.10m
r.quantile elevation.10m percentile=0,10,20,30,40,50,60,70,80,90,100
Computing histogram
100%
Computing bins
Binning data
100%
Sorting bins
100%
Computing quantiles
0:0.000000:1061.064087
1:10.000000:1159.293774
2:20.000000:1184.320190
3:30.000000:1210.821362
4:40.000000:1251.937646
5:50.000000:1309.368164
6:60.000000:1378.708764
7:70.000000:1440.232398
8:80.000000:1525.849707
9:90.000000:1613.602832
Segmentation fault
}}}
gdb:
{{{
Program received signal SIGSEGV, Segmentation fault.
0x08049205 in compute_quantiles (recode=0) at main.c:209
209 v = (i0 == i1)
(gdb) bt
#0 0x08049205 in compute_quantiles (recode=0) at main.c:209
#1 0x0804975c in main (argc=0, argv=0x3ff00000) at main.c:326
(gdb) list
204
205 k = next - b->origin;
206 i0 = (int)floor(k);
207 i1 = (int)ceil(k);
208
209 v = (i0 == i1)
210 ? values[b->base + i0]
211 : values[b->base + i0] * (i1 - k) + values[b->base +
i1] * (k -
212
i0);
213
(gdb) bt full
#0 0x08049205 in compute_quantiles (recode=0) at main.c:209
k = 2654489
i1 = 2654489
next = 2654802
v = 1613.6028318000001
i0 = 2654489
b = (struct bin *) 0x805e9e4
prev_v = 1613.6028318000001
quant = 10
#1 0x0804975c in main (argc=0, argv=0x3ff00000) at main.c:326
module = (struct GModule *) 0xb7f3f170
opt = {input = 0xb7f3f120, quant = 0x804b028, perc = 0x804b088,
slots = 0x804b0e8}
flag = {r = 0xb7f3f0fc}
recode = 0
infile = 6
range = {min = 1061.064087, max = 1846.743408, first_time = 0}
}}}
presumably values[b->base + i0] is just outside the array.
Hamish
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/474>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list