[GRASS-dev] [GRASS GIS] #3365: r.in.gdal: crash on large dataset

GRASS GIS trac at osgeo.org
Tue Jul 4 12:42:05 PDT 2017


#3365: r.in.gdal: crash on large dataset
----------------------+---------------------------------
  Reporter:  neteler  |      Owner:  grass-dev@…
      Type:  defect   |     Status:  new
  Priority:  normal   |  Milestone:  7.2.2
 Component:  Raster   |    Version:  svn-releasebranch72
Resolution:           |   Keywords:  r.in.gdal
       CPU:  x86-64   |   Platform:  Linux
----------------------+---------------------------------

Comment (by mmetz):

 Replying to [comment:2 neteler]:
 > Using valgrind:
 >
 > {{{
 > GRASS 7.3.svn (latlong):~ > valgrind $CMD
 > ==30211== Memcheck, a memory error detector
 > ==30211== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et
 al.
 > ==30211== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright
 info
 > ==30211== Command: r.in.gdal
 input=/mnt/GFC-2015-v1.3/loss_global_forest_cover_loss_2000_2015/loss_global_forest_cover_loss_2000_2015.vrt
 output=loss_global_forest_cover_loss_2000_2015
 > ==30211==
 > Importing raster map <loss_global_forest_cover_loss_2000_2015>...
 > ==30211== Warning: client switching stacks?  SP change: 0xffee9d140 -->
 0xffe91ed30
 > ==30211==          to suppress, use: --max-stackframe=5760016 or greater
 > ==30211== Invalid write of size 8
 > ==30211==    at 0x5273D89: ??? (in
 /home/mundialis/software/grass73_svn/dist.x86_64-pc-linux-
 gnu/lib/libgrass_raster.7.3.svn.so)
 > }}}

 Maybe you need to recompile GRASS with -g in order to replace "???" with
 some real information.

 I could reproduce the problem, the segfault is caused by stack overflow
 because alloca allocates memory in the stack, while malloc and calloc
 allocate memory in the heap. I could fix the segfault by replacing
 G_alloca()/G_freea() with G_malloc()/G_free(). Please try the attached
 patch against lib/raster/.

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



More information about the grass-dev mailing list