[QGIS-trac] Re: [Quantum GIS] #1040: qgis crashes when I try to add RPF A.TOC file

Quantum GIS qgis at qgis.org
Thu Jun 12 17:49:44 EDT 2008


#1040: qgis crashes when I try to add RPF A.TOC file
--------------------------------------------------------------+-------------
        Reporter:  hamiltonsean69                             |         Owner:  nobody
            Type:  defect                                     |        Status:  new   
        Priority:  critical: causes crash or data corruption  |     Milestone:        
       Component:  Rasters                                    |       Version:  0.9.1 
      Resolution:                                             |      Keywords:  RPF   
Platform_version:  Fedora Core 8                              |      Platform:  Fedora
        Must_fix:  No                                         |   Status_info:  0     
--------------------------------------------------------------+-------------
Comment (by rouault):

 This still exists with 0.10.0, and this is not specifically due to the RPF
 A.TOC format, but the crash can happy with any raster format that declare
 subdatasets (HDF4, HDF5, OGDI raster, netCDF, RS2 and ADRG drivers are
 also concerned by this). The main raster has no data itself, but declares
 a list of subdatasets that can be opened by GDALOpen.

 Here's the stack trace of the crash

 {{{
 Program received signal SIGABRT, Aborted.
 [Switching to Thread -1280899392 (LWP 14925)]
 0xffffe410 in __kernel_vsyscall ()
 (gdb) bt
 #0  0xffffe410 in __kernel_vsyscall ()
 #1  0xb59fc875 in raise () from /lib/tls/i686/cmov/libc.so.6
 #2  0xb59fe201 in abort () from /lib/tls/i686/cmov/libc.so.6
 #3  0xb62f462a in CPLErrorV (eErrClass=CE_Fatal, err_no=10, fmt=0xb69b7f44
 "Pointer '%s' is NULL in '%s'.\n", args=0xbfdd213c
 "<\177\233�\205\201\233�4\236\"�����")
     at cpl_error.cpp:233
 #4  0xb62f46c4 in CPLError (eErrClass=CE_Fatal, err_no=10, fmt=0xb69b7f44
 "Pointer '%s' is NULL in '%s'.\n") at cpl_error.cpp:133
 #5  0xb62cff8d in GDALGetOverviewCount (hBand=0x0) at
 gdalrasterband.cpp:1855
 #6  0xb7165862 in QgsRasterLayer::readFile () from
 /usr/lib/libqgis_core.so.0.10
 #7  0xb716b572 in QgsRasterLayer::QgsRasterLayer () from
 /usr/lib/libqgis_core.so.0.10
 #8  0x080fccc6 in QgisApp::addRasterLayer ()
 #9  0x08104abf in QgisApp::openLayer ()
 #10 0x080f9f5f in main ()
 }}}



 In fact, this is due to the following code snipet that makes the
 assumption that the return of GDALGetRasterBand(hDS, 1) will be non-NULL.


 {{{
   //check f this file has pyramids
   GDALRasterBandH myGDALBand = GDALGetRasterBand( mGdalDataset, 1 );
 //just use the first band
   if( GDALGetOverviewCount(myGDALBand) > 0 )
   {
     hasPyramidsFlag=true;
   }
   else
   {
     hasPyramidsFlag=false;
   }
 }}}


 The quickest fix is to apply the attached patch. In a longer term, it may
 be good to support subdatasets, by displaying the list of subdatasets to
 the user, as OpenEV does.

-- 
Ticket URL: <http://trac.osgeo.org/qgis/ticket/1040#comment:2>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list