Opened 11 years ago

Closed 11 years ago

#1932 closed defect (fixed)

r.univar segfault on map with massive values

Reported by: hamish Owned by: grass-dev@…
Priority: normal Milestone: 6.4.3
Component: Raster Version: svn-develbranch6
Keywords: r.univar Cc: johannesradinger@…, jradinger
CPU: x86-64 Platform: Linux

Description

as seen on the ML:

http://lists.osgeo.org/pipermail/grass-user/2013-April/067810.html

r.univar's stack gets smashed if the values in the map are huge:

G65> g.region -d    # spearfish
G65> r.mapcalc "bigvals = 1.0e200 * elevation.10m"

G65> r.info -r bigvals
min=1.061111206e+203
max=1.846390747e+203

G65> r.univar bigvals
 100%
Segmentation fault

G65> g.gisenv set="DEBUG=5"
G65> r.univar bigvals
...
D2/5: G__read_Cell_head
D2/5: G__read_Cell_head_array
D3/5: region item: proj:       1
D3/5: region item: zone:       13
D3/5: region item: north:      4928010
D3/5: region item: south:      4913700
D3/5: region item: east:       609000
D3/5: region item: west:       589980
D3/5: region item: cols:       634
D3/5: region item: rows:       477
D3/5: region item: e-w resol:  30
D3/5: region item: n-s resol:  30
D3/5: region item: format:     -1
D3/5: region item: compressed: 1
D3/5: create window mapping (634 columns)
 100%
Segmentation fault

G65> g.gisenv set="DEBUG=0"
G65> gdb `which r.univar`
(gdb) run bigvals
[...]
Program received signal SIGSEGV, Segmentation fault.
0x00000000004036e0 in print_stats (stats=0x608490) at stats.c:141
141		    fprintf(stdout, "total null and non-null cells: %d\n", stats[z].size);

Hamish

Change History (4)

comment:1 by hamish, 11 years ago

kdbg tells me z=960050486, (*stats).size=302418

stats[1195].size is the biggest array element I can get to before it tells me I can't access the memory address.

Hamish

comment:2 by jradinger, 11 years ago

Cc: jradinger added

in reply to:  2 comment:3 by mmetz, 11 years ago

Replying to jradinger: Try r55876

comment:4 by hamish, 11 years ago

Resolution: fixed
Status: newclosed

thanks; tested in relbr64 and devbr6 too, all good.

Hamish

Note: See TracTickets for help on using tickets.