[GRASS-dev] [GRASS GIS] #1932: r.univar segfault on map with massive values

#1932: r.univar segfault on map with massive values
----------------------+-----------------------------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: svn-develbranch6
Keywords: r.univar | Platform: Linux
      Cpu: x86-64 |
----------------------+-----------------------------------------------------
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

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1932&gt;
GRASS GIS <http://grass.osgeo.org>

#1932: r.univar segfault on map with massive values
----------------------+-----------------------------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: svn-develbranch6
Keywords: r.univar | Platform: Linux
      Cpu: x86-64 |
----------------------+-----------------------------------------------------

Comment(by hamish):

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

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1932#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1932: r.univar segfault on map with massive values
----------------------+-----------------------------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: svn-develbranch6
Keywords: r.univar | Platform: Linux
      Cpu: x86-64 |
----------------------+-----------------------------------------------------
Changes (by jradinger):

* cc: jradinger (added)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1932#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1932: r.univar segfault on map with massive values
----------------------+-----------------------------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: svn-develbranch6
Keywords: r.univar | Platform: Linux
      Cpu: x86-64 |
----------------------+-----------------------------------------------------

Comment(by mmetz):

Replying to [comment:2 jradinger]:
Try r55876

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1932#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1932: r.univar segfault on map with massive values
---------------------+------------------------------------------------------
  Reporter: hamish | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 6.4.3
Component: Raster | Version: svn-develbranch6
Resolution: fixed | Keywords: r.univar
  Platform: Linux | Cpu: x86-64
---------------------+------------------------------------------------------
Changes (by hamish):

  * status: new => closed
  * resolution: => fixed

Comment:

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

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1932#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

thanks, also tested (in devbr6 and trunk7) and everything working now.

···

On Thu, Apr 18, 2013 at 10:31 AM, GRASS GIS <trac@osgeo.org> wrote:

#1932: r.univar segfault on map with massive values

---------------------±-----------------------------------------------------
Reporter: hamish | Owner: grass-dev@…
Type: defect | Status: closed

Priority: normal | Milestone: 6.4.3
Component: Raster | Version: svn-develbranch6

Resolution: fixed | Keywords: r.univar
Platform: Linux | Cpu: x86-64
---------------------±-----------------------------------------------------
Changes (by hamish):

  • status: new => closed
  • resolution: => fixed

Comment:

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

Hamish


Ticket URL: <https://trac.osgeo.org/grass/ticket/1932#comment:4>
GRASS GIS <http://grass.osgeo.org>