Ticket #4765 (closed defect: fixed)

Opened 10 months ago

Last modified 10 months ago

x64 issue in BT dataset driver

Reported by: murphke1 Owned by: warmerdam
Priority: normal Milestone: 1.9.2
Component: GDAL_Raster Version: 1.9.1
Severity: normal Keywords: bt
Cc:

Description (last modified by warmerdam) (diff)

Found what appears to be a GDAL bug today. Attempting to use "gdal_translate" on a 4 Gig BT file. Note that my GDAL code date is 20120516, in case its already been addressed.

In "btdataset.cpp" the line below fails because the conversion to int64 doesn't happen until after the multiply and add. None of the multipliers are int64 so you get integer overflow before the value is converted to int64 when it gets passed in to the function.

/* -------------------------------------------------------------------- */
/*      Seek to profile.                                                */
/* -------------------------------------------------------------------- */
   if( VSIFSeekL( fpImage, 
                  256 + nBlockXOff * nDataSize * nRasterYSize, 
                  SEEK_SET ) != 0 )	
   {
       CPLError( CE_Failure, CPLE_FileIO, 
                 ".bt Seek failed:%s", VSIStrerror( errno ) );
       return CE_Failure;
   }

Replacing it with the below sorted that out. Still trying to process the file - there may be other int64 issues.

/* -------------------------------------------------------------------- */
/*      Seek to profile.                                                */
/* -------------------------------------------------------------------- */
   if( VSIFSeekL( fpImage, 
                  256 + (__int64)nBlockXOff * (__int64)nDataSize * (__int64)nRasterYSize, 
                  SEEK_SET ) != 0 )
   {
       CPLError( CE_Failure, CPLE_FileIO, 
                 ".bt Seek failed:%s", VSIStrerror( errno ) );
       return CE_Failure;
   }

Kevin Murphy

Change History

Changed 10 months ago by murphke1

  • version changed from unspecified to 1.9.1
  • component changed from default to GDAL_Raster

Changed 10 months ago by warmerdam

  • keywords bt added
  • status changed from new to assigned
  • description modified (diff)

Changed 10 months ago by warmerdam

I have applied a slight variation on this change in trunk (r24724). Could you confirm things work with this change? Once confirmed the change could be backported to 1.9 and the ticket closed.

Changed 10 months ago by murphke1

It looks like it ought to work fine. I'll try to recompile and check it out tomorrow.

Changed 10 months ago by murphke1

  • status changed from assigned to closed
  • resolution set to fixed

Works fine for me with your version of the code.

Changed 10 months ago by warmerdam

  • milestone set to 1.9.2

Back ported change to 1.9 (r24733).

Note: See TracTickets for help on using tickets.