Opened 16 years ago
Closed 16 years ago
#2045 closed defect (fixed)
Regression in HDF4 due to r12768
Reported by: | Even Rouault | Owned by: | dron |
---|---|---|---|
Priority: | high | Milestone: | 1.5.0 |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | hdf4 |
Cc: | warmerdam, Even Rouault, nowakpl |
Description
This follows a chat with Nowak on IRC.
gdalinfo on HDF4_EOS:EOS_SWATH:"AST_L1B_00311202007185148_20071124043516_31691.hdf":VNIR_Swath:ImageData1 (ftp://e4ftl01u.ecs.nasa.gov/ASTER/ASTT/AST_L1B.003/2007.11.20/AST_L1B_00311202007185148_20071124043516_31691.hdf)
crashes with :
(gdb) r HDF4_EOS:EOS_SWATH:"AST_L1B_00311202007185148_20071124043516_31691.hdf":VNIR_Swath:ImageData1 Starting program: /usr/opt/gdal-r13202-debug_x86-64_ubuntu7/bin/gdalinfo HDF4_EOS:EOS_SWATH:"AST_L1B_00311202007185148_20071124043516_31691.hdf":VNIR_Swath:ImageData1 [Thread debugging using libthread_db enabled] [New Thread 47322398220384 (LWP 8505)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 47322398220384 (LWP 8505)] 0x000000000052ba42 in GDALDataset::GetRasterBand (this=0xa78810, nBandId=1) at gdaldataset.cpp:484 484 return( papoBands[nBandId-1] ); Current language: auto; currently c++ (gdb) bt #0 0x000000000052ba42 in GDALDataset::GetRasterBand (this=0xa78810, nBandId=1) at gdaldataset.cpp:484 #1 0x0000000000535e46 in GDALPamDataset::PamInitialize (this=0xa78810) at gdalpamdataset.cpp:330 #2 0x0000000000535f09 in GDALPamDataset::SetMetadata (this=0xa78810, papszMetadata=0xaef9d0, pszDomain=0x715780 "") at gdalpamdataset.cpp:1088 #3 0x00000000004355f1 in HDF4ImageDataset::GetSwatAttrs (this=0xa78810, hSW=1048576) at hdf4imagedataset.cpp:1357 #4 0x000000000043abe4 in HDF4ImageDataset::Open (poOpenInfo=0x7fff9368e040) at hdf4imagedataset.cpp:2280 #5 0x000000000052c276 in GDALOpen (pszFilename=0xa77c40 "HDF4_EOS:EOS_SWATH:AST_L1B_00311202007185148_20071124043516_31691.hdf:VNIR_Swath:ImageData1", eAccess=GA_ReadOnly) at gdaldataset.cpp:1774 #6 0x0000000000409515 in main (argc=2, argv=0xa78000) at gdalinfo.c:129
Change History (4)
comment:1 by , 16 years ago
Cc: | added |
---|---|
Component: | default → GDAL_Raster |
Keywords: | hdf4 added |
Milestone: | → 1.5.0 |
Owner: | changed from | to
Priority: | normal → high |
comment:2 by , 16 years ago
Cc: | added |
---|
comment:3 by , 16 years ago
Maybe it doesn't fix the problem since there's is no raster band reported by gdalinfo. I get 120 GCPs, a huge list of metadata, GeoLocation info, Image size, but no raster band.
Also, I observe another crash, maybe not related to the first one when trying : gdalinfo HDF4_EOS:EOS_SWATH:"AST_L1B_00311202007185148_20071124043516_31691.hdf":VNIR_Swath:BLABLABLA
==7332== Memcheck, a memory error detector. ==7332== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==7332== Using LibVEX rev 1732, a library for dynamic binary translation. ==7332== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==7332== Using valgrind-3.2.3-Debian, a dynamic binary instrumentation framework. ==7332== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==7332== For more details, rerun with: -v ==7332== ==7332== Conditional jump or move depends on uninitialised value(s) ==7332== at 0x42D7AC8: CSLTokenizeString2 (cpl_string.cpp:738) ==7332== by 0x41569F2: HDF4ImageDataset::GetImageDimensions(char*) (hdf4imagedataset.cpp:1188) ==7332== by 0x415CDEA: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2268) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== ==7332== Conditional jump or move depends on uninitialised value(s) ==7332== at 0x42D7AD6: CSLTokenizeString2 (cpl_string.cpp:836) ==7332== by 0x41569F2: HDF4ImageDataset::GetImageDimensions(char*) (hdf4imagedataset.cpp:1188) ==7332== by 0x415CDEA: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2268) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== ==7332== Conditional jump or move depends on uninitialised value(s) ==7332== at 0x42D7AC8: CSLTokenizeString2 (cpl_string.cpp:738) ==7332== by 0x415CF21: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2314) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== ==7332== Conditional jump or move depends on uninitialised value(s) ==7332== at 0x42D7AD6: CSLTokenizeString2 (cpl_string.cpp:836) ==7332== by 0x415CF21: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2314) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== ==7332== Invalid read of size 4 ==7332== at 0x415877A: HDF4ImageDataset::ProcessSwathGeolocation(long, char**) (hdf4imagedataset.cpp:1688) ==7332== by 0x415CF49: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2315) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== Address 0x668AF14 is 4 bytes before a block of size 4 alloc'd ==7332== at 0x4021AA4: calloc (vg_replace_malloc.c:279) ==7332== by 0x42DEEEF: VSICalloc (cpl_vsisimple.cpp:270) ==7332== by 0x42CCCDB: CPLCalloc (cpl_conv.cpp:81) ==7332== by 0x42D7B80: CSLTokenizeString2 (cpl_string.cpp:851) ==7332== by 0x415CF21: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2314) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== ==7332== Invalid read of size 1 ==7332== at 0x5318F1E: strstr (in /lib/tls/i686/cmov/libc-2.6.1.so) ==7332== by 0x4158798: HDF4ImageDataset::ProcessSwathGeolocation(long, char**) (hdf4imagedataset.cpp:1688) ==7332== by 0x415CF49: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2315) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== Address 0x668A8C0 is 0 bytes inside a block of size 2 free'd ==7332== at 0x402237F: free (vg_replace_malloc.c:233) ==7332== by 0x42DEE76: VSIFree (cpl_vsisimple.cpp:301) ==7332== by 0x42D719E: CSLDestroy (cpl_string.cpp:178) ==7332== by 0x415482E: HDF4Dataset::TranslateHDF4EOSAttributes(long, long, long, char**) (in /home/even/downloads/mapserver/gdal.svn.commit/gdal/libgdal.so) ==7332== by 0x4154C51: HDF4Dataset::ReadGlobalAttributes(long) (in /home/even/downloads/mapserver/gdal.svn.commit/gdal/libgdal.so) ==7332== by 0x41575CC: HDF4ImageDataset::GetSwatAttrs(long) (hdf4imagedataset.cpp:1260) ==7332== by 0x415CE13: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2280) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== ==7332== Invalid read of size 4 ==7332== at 0x4158849: HDF4ImageDataset::ProcessSwathGeolocation(long, char**) (hdf4imagedataset.cpp:1696) ==7332== by 0x415CF49: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2315) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== Address 0x668AF10 is 8 bytes before a block of size 4 alloc'd ==7332== at 0x4021AA4: calloc (vg_replace_malloc.c:279) ==7332== by 0x42DEEEF: VSICalloc (cpl_vsisimple.cpp:270) ==7332== by 0x42CCCDB: CPLCalloc (cpl_conv.cpp:81) ==7332== by 0x42D7B80: CSLTokenizeString2 (cpl_string.cpp:851) ==7332== by 0x415CF21: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2314) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== ==7332== Invalid read of size 1 ==7332== at 0x5318F1E: strstr (in /lib/tls/i686/cmov/libc-2.6.1.so) ==7332== by 0x4158867: HDF4ImageDataset::ProcessSwathGeolocation(long, char**) (hdf4imagedataset.cpp:1696) ==7332== by 0x415CF49: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2315) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129) ==7332== Address 0x668A230 is 0 bytes inside a block of size 6 free'd ==7332== at 0x402237F: free (vg_replace_malloc.c:233) ==7332== by 0x42DEE76: VSIFree (cpl_vsisimple.cpp:301) ==7332== by 0x42D719E: CSLDestroy (cpl_string.cpp:178) ==7332== by 0x415482E: HDF4Dataset::TranslateHDF4EOSAttributes(long, long, long, char**) (in /home/even/downloads/mapserver/gdal.svn.commit/gdal/libgdal.so) ==7332== by 0x4154C51: HDF4Dataset::ReadGlobalAttributes(long) (in /home/even/downloads/mapserver/gdal.svn.commit/gdal/libgdal.so) ==7332== by 0x41575CC: HDF4ImageDataset::GetSwatAttrs(long) (hdf4imagedataset.cpp:1260) ==7332== by 0x415CE13: HDF4ImageDataset::Open(GDALOpenInfo*) (hdf4imagedataset.cpp:2280) ==7332== by 0x42AC5F1: GDALOpen (gdaldataset.cpp:1774) ==7332== by 0x8049E3A: main (gdalinfo.c:129)
comment:4 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This one should be fixed now in trunk.
I've identified this being due to r12768 where code has been moved to HDF4ImageDataset::GetImageDimensions. There is an infortunate use of "int nBands" at line 2198 in HDF4ImageDataset::Open. That's "OK" since it's a static method. But ::GetImageDimensions is not a static method, so nBands = 1 at line 1196 of hdf4imagedataset.cpp overwride the value of the GDALDataset object ! Hence the crash in GDALPamDataset::PamInitialize.
This variable should be renamed to something else, to avoid confusion. Adding int nBands = 0; as a quick and dirty fix at line 1190 seems to fix the problem...