Opened 17 years ago

Closed 17 years ago

#1573 closed defect (fixed)

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

Reported by: epatton Owned by: 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 (1)

45_18_N_66_06_W_BACKSCATTER.hdr (126 bytes ) - added by epatton 17 years ago.
Header file from the ESRI floating point raster that caused the error

Download all attachments as: .zip

Change History (2)

by epatton, 17 years ago

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

comment:3 by warmerdam, 17 years ago

Component: defaultGDAL_Raster
Description: modified (diff)
Keywords: ehdr added
Milestone: 1.4.2
Resolution: fixed
Status: newclosed
Version: unspecified1.4.0

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.

Note: See TracTickets for help on using tickets.