Opened 20 years ago

Last modified 20 years ago

#507 closed defect (fixed)

Large file I/O fails with HFA files on the SGI Altix platform

Reported by: mark@… Owned by: warmerdam
Priority: high Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: VERIFIED
Cc:

Description

Creating large (meaning > 4.2GB) files on the SGI Altix system fails to detect
that an external .ige file is needed.  This results in a single corrupt .img file.  
The SGI Altix platform uses a 64bit linux based on Red Hat Advanced Server 2.1AS. 
This defines a word as having 64bits, which defines ULONG_MAX to be (2^64)-1. 
When the HFA loader determines if an .ige file is needed in hfaopen.cpp, it
should compare against (2^32)-1, not ULONG_MAX.  This limit is a file spec
limit, not a system limit.

Change History (3)

comment:1 by warmerdam, 20 years ago

Made this release critical for 1.2.0.

I have modified the check in the HFACreate() function to look like this now:

/* -------------------------------------------------------------------- */
/*      Check whether we should create external large file with         */
/*      image.  We create a spill file if the amount of imagery is      */
/*      close to 4GB.  We don't check the amount of auxilary            */
/*      information, so in theory if there were an awful lot of         */
/*      non-imagery data our approximate size could be smaller than     */
/*      the file will actually we be.  We leave room for 10MB of        */
/*      auxilary data.                                                  */
/* -------------------------------------------------------------------- */
    double dfApproxSize = (double)nBytesPerBlock * (double)nBlocks *
        (double)nBands + 10000000.0;

    if( dfApproxSize > 429496729.0 )
    {
	HFAEntry *poImgFormat;

	bCreateLargeRaster = TRUE;
	poImgFormat =
	    new HFAEntry( psInfo, "IMGFormatInfo",
			  "ImgFormatInfo831", psInfo->poRoot );
	poImgFormat->MakeData();
	poImgFormat->SetIntField( "spaceUsedForRasterData", 0 );
    }


This avoids use of ULONG_MAX, and also ensures that space is going to 
be available for the non-imagery auxilary data. 

Could you confirm that things work now Mark?

comment:2 by warmerdam, 20 years ago

I am closing this under the assumption things are fine.  Please re-open if
you believe it is still broken.

comment:3 by mark@…, 20 years ago

This fix seems to solve it.  Thanks.
Note: See TracTickets for help on using tickets.