[gdal-dev] hdf5dataset.cpp patch

David Burken dburken at comcast.net
Tue Aug 24 02:35:28 EDT 2010


  Hi Everyone,

gdalinfo was core dumping in method HDF5AttrIterate on some hdf5 data we 
have.  The value of nAttrSize was greater than the hard coded array 
length of 8192.  I changed the array size to be dynamic and it seems to 
be working now on my small sample of two data sets.

svn diff below.  I can send whole file if someone would like it but did 
not want to do that to the list.

Take care,
Dave

hdf5dataset.cpp:

599c599
<     char            szData[8192];
---
 >     char            *szData = NULL;
609,610c609,610
<     char            szTemp[8192];
<     char            szValue[8192];
---
 >     char           *szTemp = (char*) CPLMalloc( 8192 );
 >     char           *szValue = NULL;
622,624d621
<
<     szValue[0] ='\0';
<
626a624,625
 >         szData = (char*) CPLMalloc(nAttrSize+1);
 >         szValue = (char*) CPLMalloc(nAttrSize+1);
628a628
 >         szValue[nAttrSize]='\0';
639a640,643
 >             szData = (char*) CPLMalloc( 8192 );
 >             szValue = (char*) CPLMalloc( 8192 );
 >             szData[0]='\0';
 >             szValue[0] ='\0';
709a714,716
 >     CPLFree( szTemp );
 >     CPLFree( szData );
 >     CPLFree( szValue );



More information about the gdal-dev mailing list