Ticket #1573 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

ERROR 2: CPLCalloc(): Out of memory allocating when importing EHdr/ESRI .hdr Labelled raster

Reported by: epatton Assigned to: warmerdam
Priority: normal Milestone: 1.4.2
Component: GDAL_Raster Version: 1.4.0
Severity: normal Keywords: ehdr
Cc:

Description (Last modified by warmerdam)

I'm trying to import an ESRI flt raster into Grass 6.3.cvs using r.in.gdal. Using fresh gdal 1.4.1 from today, and fresh Grass 6.3 cvs update from today on Ubuntu 7.04 Beta.

$ gdalinfo -mm 45_18_N_66_06_W_BACKSCATTER.flt

Driver: EHdr/ESRI .hdr Labelled
Size is 2641, 3721
Coordinate System is `'
Origin = (2531369.500000000000000,7366720.500000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Corner Coordinates:
Upper Left  ( 2531369.500, 7366720.500) 
Lower Left  ( 2531369.500, 7362999.500) 
Upper Right ( 2534010.500, 7366720.500) 
Lower Right ( 2534010.500, 7362999.500) 
Center      ( 2532690.000, 7364860.000) 
Band 1 Block=2641x1 Type=Byte, ColorInterp=Undefined
ERROR 2: CPLCalloc(): Out of memory allocating -329 bytes.

  Aborted (core dumped)

~ Eric.

Attachments

45_18_N_66_06_W_BACKSCATTER.hdr (126 bytes) - added by epatton on 04/11/07 15:01:03.
Header file from the ESRI floating point raster that caused the error

Change History

04/11/07 15:01:03 changed by epatton

  • attachment 45_18_N_66_06_W_BACKSCATTER.hdr added.

Header file from the ESRI floating point raster that caused the error

04/11/07 15:48:43 changed by warmerdam

  • status changed from new to closed.
  • description changed.
  • component changed from default to GDAL_Raster.
  • version changed from unspecified to 1.4.0.
  • milestone set to 1.4.2.
  • keywords set to ehdr.
  • resolution set to fixed.

The problem is related to initialization when the NBITS keyword is missing from the .hdr file. In 1.4.0 a bunch of new code was introduced for NBITS < 8, but it also added a dependency on having the keyword present.

The workaround is to add "NBITS 8" in the .hdr file.

Fix is to default to 8 in the code. The fix has been committed in trunk, and 1.4 branch and it should be released in 1.4.2.