Opened 11 years ago

Closed 11 years ago

#3614 closed defect (duplicate)

gdaladdo crashes (SIGFPE) on LZW compressed TIFFs

Reported by: dstahlke Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

This appears to be different than bug #1205.

$ pgmmake 0 11108 11624 > test.pgm
$ gdal_translate test.pgm test.tif -co 'COMPRESS=LZW'
$ gdaladdo test.tif 3
0Floating point exception (core dumped)

It only happens for certain image and overview sizes.

The backtrace:

#0  0x00007ffff79fdefa in GDALRasterBand::RasterIO (this=0x616bb0, eRWFlag=<value optimized out>, nXOff=3703, 
    nYOff=<value optimized out>, nXSize=<value optimized out>, nYSize=<value optimized out>, pData=0x616290, nBufXSize=0, nBufYSize=1, 
    eBufType=GDT_Float32, nPixelSpace=4, nLineSpace=0) at gdalrasterband.cpp:202
#1  0x00007ffff7a03240 in GDALDownsampleChunk32R (nSrcWidth=<value optimized out>, nSrcHeight=<value optimized out>, 
    pafChunk=<value optimized out>, pabyChunkNodataMask=<value optimized out>, nChunkXOff=<value optimized out>, 
    nChunkXSize=<value optimized out>, nChunkYOff=0, nChunkYSize=383, poOverview=0x616bb0, pszResampling=0x4017da "nearest", 
    bHasNoData=0, fNoDataValue=<value optimized out>, poColorTable=0x0, eSrcDataType=GDT_Byte) at overview.cpp:631
#2  0x00007ffff7a04790 in GDALRegenerateOverviewsMultiBand (nBands=<value optimized out>, papoSrcBands=<value optimized out>, 
    nOverviews=<value optimized out>, papapoOverviewBands=<value optimized out>, pszResampling=<value optimized out>, 
    pfnProgress=<value optimized out>, pProgressData=0x0) at overview.cpp:1421
#3  0x00007ffff788eb3e in GTiffDataset::IBuildOverviews (this=<value optimized out>, pszResampling=<value optimized out>, 
    nOverviews=<value optimized out>, panOverviewList=<value optimized out>, nBands=<value optimized out>, 
    panBandList=<value optimized out>, pfnProgress=0x7ffff79de400 <GDALTermProgress(double, char const*, void*)>, pProgressData=0x0)
    at geotiff.cpp:3444
#4  0x00007ffff79e7dca in GDALDataset::BuildOverviews (this=0x615a10, pszResampling=<value optimized out>, 
    nOverviews=<value optimized out>, panOverviewList=<value optimized out>, nListBands=<value optimized out>, 
    panBandList=<value optimized out>, pfnProgress=0x7ffff79de400 <GDALTermProgress(double, char const*, void*)>, pProgressData=0x0)
    at gdaldataset.cpp:1381
#5  0x000000000040109e in main (nArgc=3, papszArgv=0x613380) at gdaladdo.cpp:163

The relevant source code line:

/* -------------------------------------------------------------------- */
/*      If pixel and line spaceing are defaulted assign reasonable      */
/*      value assuming a packed buffer.                                 */
/* -------------------------------------------------------------------- */
    if( nPixelSpace == 0 )
        nPixelSpace = GDALGetDataTypeSize( eBufType ) / 8;

    if( nLineSpace == 0 )
    {
        if (nPixelSpace > INT_MAX / nBufXSize) // <=== crashes here
        {
            CPLError( CE_Failure, CPLE_AppDefined,
                      "Int overflow : %d x %d", nPixelSpace, nBufXSize );
            return CE_Failure;
        }
        nLineSpace = nPixelSpace * nBufXSize;
    }

Change History (1)

comment:1 Changed 11 years ago by Even Rouault

Resolution: duplicate
Status: newclosed

Thanks for reporting. Duplicate of #3582 whose fix was incorporated in SVN a few weeks ago. Will be available with GDAL 1.7.3

Note: See TracTickets for help on using tickets.