contrib/addtiffo/tif_overview.c:866: error: Integer Overflow L2
  ([0, 4294967294] + [0, 4294967294]):unsigned32 by call to `TIFF_ProcessFullResBlock`.

contrib/addtiffo/tif_overview.c:685:1: Parameter `hTIFF->tif_dir.td_imagedepth`
683. /************************************************************************/
684. 
685. void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,
     ^
686.                          int bUseSubIFDs, const char *pszResampleMethod,
687.                          int (*pfnProgress)( double, void * ),

contrib/addtiffo/tif_overview.c:866:13: Call
864.              */
865.             
866.             TIFF_ProcessFullResBlock( hTIFF, nPlanarConfig,
                 ^
867.                                       bSubsampled,nHorSubsampling,nVerSubsampling,
868.                                       nOverviews, panOvList,

contrib/addtiffo/tif_overview.c:540:1: Parameter `hTIFF->tif_dir.td_imagedepth`
  538. /************************************************************************/
  539. 
  540. void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,
       ^
  541.                                int bSubsampled,
  542.                                int nHorSubsampling, int nVerSubsampling,

contrib/addtiffo/tif_overview.c:566:38: Call
  564.             {
  565.                 TIFFReadEncodedTile( hTIFF,
  566.                                      TIFFComputeTile(hTIFF, nSXOff, nSYOff,
                                            ^
  567.                                                      0, (tsample_t)iSample ),
  568.                                      pabySrcTile,

libtiff/tif_tile.c:63:1: <LHS trace>
61.  * Compute which tile an (x,y,z,s) value is in.
62.  */
63. uint32
    ^
64. TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s)
65. {

libtiff/tif_tile.c:63:1: Parameter `tif->tif_dir.td_imagedepth`
    61.  * Compute which tile an (x,y,z,s) value is in.
    62.  */
    63. uint32
        ^
    64. TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s)
    65. {

libtiff/tif_tile.c:63:1: <RHS trace>
61.  * Compute which tile an (x,y,z,s) value is in.
62.  */
63. uint32
    ^
64. TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s)
65. {

libtiff/tif_tile.c:63:1: Parameter `tif->tif_dir.td_imagedepth`
    61.  * Compute which tile an (x,y,z,s) value is in.
    62.  */
    63. uint32
        ^
    64. TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s)
    65. {

libtiff/tif_tile.c:83:16: Binary operation: ([0, 4294967294] + [0, 4294967294]):unsigned32 by call to `TIFF_ProcessFullResBlock` 
    81. 		uint32 xpt = TIFFhowmany_32(td->td_imagewidth, dx);
    82. 		uint32 ypt = TIFFhowmany_32(td->td_imagelength, dy);
    83. 		uint32 zpt = TIFFhowmany_32(td->td_imagedepth, dz);
                       ^
    84. 
    85. 		if (td->td_planarconfig == PLANARCONFIG_SEPARATE) 

uint32
TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s)
{
	TIFFDirectory *td = &tif->tif_dir;
	uint32 dx = td->td_tilewidth;
	uint32 dy = td->td_tilelength;
	uint32 dz = td->td_tiledepth;
	uint32 tile = 1;
	if (td->td_imagedepth == 1)
		z = 0;
	if (dx == (uint32) -1)
		dx = td->td_imagewidth;
	if (dy == (uint32) -1)
		dy = td->td_imagelength;
	if (dz == (uint32) -1)
		dz = td->td_imagedepth;
	if (dx != 0 && dy != 0 && dz != 0) {
		uint32 xpt = TIFFhowmany_32(td->td_imagewidth, dx);
		uint32 ypt = TIFFhowmany_32(td->td_imagelength, dy);
		uint32 zpt = TIFFhowmany_32(td->td_imagedepth, dz);
		if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
			tile = (xpt*ypt*zpt)*s +
			     (xpt*ypt)*(z/dz) +
			     xpt*(y/dy) +
			     x/dx;
		else
			tile = (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx;
	}
	return (tile);
}
['void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,\n                         int bUseSubIFDs, const char *pszResampleMethod,\n                         int (*pfnProgress)( double, void * ),\n                         void * pProgressData )\n{\n    TIFFOvrCache\t**papoRawBIs;\n    uint32\t\tnXSize, nYSize, nBlockXSize, nBlockYSize;\n    uint16\t\tnBitsPerPixel, nPhotometric, nCompressFlag, nSamples,\n        nPlanarConfig, nSampleFormat;\n    int         bSubsampled;\n    uint16      nHorSubsampling, nVerSubsampling;\n    int\t\t\tbTiled, nSXOff, nSYOff, i;\n    unsigned char\t*pabySrcTile;\n    uint16\t\t*panRedMap, *panGreenMap, *panBlueMap;\n    TIFFErrorHandler    pfnWarning;\n    (void) pfnProgress;\n    (void) pProgressData;\n    TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &nXSize );\n    TIFFGetField( hTIFF, TIFFTAG_IMAGELENGTH, &nYSize );\n    TIFFGetField( hTIFF, TIFFTAG_BITSPERSAMPLE, &nBitsPerPixel );\n    TIFFGetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, &nSamples );\n    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_PLANARCONFIG, &nPlanarConfig );\n    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_PHOTOMETRIC, &nPhotometric );\n    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_COMPRESSION, &nCompressFlag );\n    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_SAMPLEFORMAT, &nSampleFormat );\n    if( nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB )\n    {\n        if( nBitsPerPixel != 8 || nSamples != 3 || nPlanarConfig != PLANARCONFIG_CONTIG ||\n            nSampleFormat != SAMPLEFORMAT_UINT)\n        {\n            TIFFErrorExt( TIFFClientdata(hTIFF), "TIFFBuildOverviews",\n                          "File `%s\' has an unsupported subsampling configuration.\\n",\n                          TIFFFileName(hTIFF) );\n            return;\n        }\n        bSubsampled = 1;\n        TIFFGetField( hTIFF, TIFFTAG_YCBCRSUBSAMPLING, &nHorSubsampling, &nVerSubsampling );\n    }\n    else\n    {\n        if( nBitsPerPixel < 8 )\n        {\n            TIFFErrorExt( TIFFClientdata(hTIFF), "TIFFBuildOverviews",\n                          "File `%s\' has samples of %d bits per sample.  Sample\\n"\n                          "sizes of less than 8 bits per sample are not supported.\\n",\n                          TIFFFileName(hTIFF), nBitsPerPixel );\n            return;\n        }\n        bSubsampled = 0;\n        nHorSubsampling = 1;\n        nVerSubsampling = 1;\n    }\n    pfnWarning = TIFFSetWarningHandler( NULL );\n    if( TIFFGetField( hTIFF, TIFFTAG_ROWSPERSTRIP, &(nBlockYSize) ) )\n    {\n        nBlockXSize = nXSize;\n        bTiled = FALSE;\n    }\n    else\n    {\n        TIFFGetField( hTIFF, TIFFTAG_TILEWIDTH, &nBlockXSize );\n        TIFFGetField( hTIFF, TIFFTAG_TILELENGTH, &nBlockYSize );\n        bTiled = TRUE;\n    }\n    if( TIFFGetField( hTIFF, TIFFTAG_COLORMAP,\n                      &panRedMap, &panGreenMap, &panBlueMap ) )\n    {\n        uint16\t\t*panRed2, *panGreen2, *panBlue2;\n        int             nColorCount = 1 << nBitsPerPixel;\n        panRed2 = (uint16 *) _TIFFmalloc(2*nColorCount);\n        panGreen2 = (uint16 *) _TIFFmalloc(2*nColorCount);\n        panBlue2 = (uint16 *) _TIFFmalloc(2*nColorCount);\n        memcpy( panRed2, panRedMap, 2 * nColorCount );\n        memcpy( panGreen2, panGreenMap, 2 * nColorCount );\n        memcpy( panBlue2, panBlueMap, 2 * nColorCount );\n        panRedMap = panRed2;\n        panGreenMap = panGreen2;\n        panBlueMap = panBlue2;\n    }\n    else\n    {\n        panRedMap = panGreenMap = panBlueMap = NULL;\n    }\n    papoRawBIs = (TIFFOvrCache **) _TIFFmalloc(nOverviews*sizeof(void*));\n    for( i = 0; i < nOverviews; i++ )\n    {\n        uint32  nOXSize, nOYSize, nOBlockXSize, nOBlockYSize;\n        toff_t  nDirOffset;\n        nOXSize = (nXSize + panOvList[i] - 1) / panOvList[i];\n        nOYSize = (nYSize + panOvList[i] - 1) / panOvList[i];\n        nOBlockXSize = MIN(nBlockXSize,nOXSize);\n        nOBlockYSize = MIN(nBlockYSize,nOYSize);\n        if( bTiled )\n        {\n            if( (nOBlockXSize % 16) != 0 )\n                nOBlockXSize = nOBlockXSize + 16 - (nOBlockXSize % 16);\n            if( (nOBlockYSize % 16) != 0 )\n                nOBlockYSize = nOBlockYSize + 16 - (nOBlockYSize % 16);\n        }\n        nDirOffset = TIFF_WriteOverview( hTIFF, nOXSize, nOYSize,\n                                         nBitsPerPixel, nPlanarConfig,\n                                         nSamples, nOBlockXSize, nOBlockYSize,\n                                         bTiled, nCompressFlag, nPhotometric,\n                                         nSampleFormat,\n                                         panRedMap, panGreenMap, panBlueMap,\n                                         bUseSubIFDs,\n                                         nHorSubsampling, nVerSubsampling );\n        papoRawBIs[i] = TIFFCreateOvrCache( hTIFF, nDirOffset );\n    }\n    if( panRedMap != NULL )\n    {\n        _TIFFfree( panRedMap );\n        _TIFFfree( panGreenMap );\n        _TIFFfree( panBlueMap );\n    }\n    if( bTiled )\n        pabySrcTile = (unsigned char *) _TIFFmalloc(TIFFTileSize(hTIFF));\n    else\n        pabySrcTile = (unsigned char *) _TIFFmalloc(TIFFStripSize(hTIFF));\n    for( nSYOff = 0; nSYOff < (int) nYSize; nSYOff += nBlockYSize )\n    {\n        for( nSXOff = 0; nSXOff < (int) nXSize; nSXOff += nBlockXSize )\n        {\n            TIFF_ProcessFullResBlock( hTIFF, nPlanarConfig,\n                                      bSubsampled,nHorSubsampling,nVerSubsampling,\n                                      nOverviews, panOvList,\n                                      nBitsPerPixel, nSamples, papoRawBIs,\n                                      nSXOff, nSYOff, pabySrcTile,\n                                      nBlockXSize, nBlockYSize,\n                                      nSampleFormat, pszResampleMethod );\n        }\n    }\n    _TIFFfree( pabySrcTile );\n    for( i = 0; i < nOverviews; i++ )\n    {\n        TIFFDestroyOvrCache( papoRawBIs[i] );\n    }\n    if( papoRawBIs != NULL )\n        _TIFFfree( papoRawBIs );\n    TIFFSetWarningHandler( pfnWarning );\n}', 'void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,\n                               int bSubsampled,\n                               int nHorSubsampling, int nVerSubsampling,\n                               int nOverviews, int * panOvList,\n                               int nBitsPerPixel,\n                               int nSamples, TIFFOvrCache ** papoRawBIs,\n                               uint32 nSXOff, uint32 nSYOff,\n                               unsigned char *pabySrcTile,\n                               uint32 nBlockXSize, uint32 nBlockYSize,\n                               int nSampleFormat, const char * pszResampling )\n{\n    int\t\tiOverview, iSample;\n    for( iSample = 0; iSample < nSamples; iSample++ )\n    {\n        if( nPlanarConfig == PLANARCONFIG_SEPARATE || iSample == 0 )\n        {\n            if( TIFFIsTiled(hTIFF) )\n            {\n                TIFFReadEncodedTile( hTIFF,\n                                     TIFFComputeTile(hTIFF, nSXOff, nSYOff,\n                                                     0, (tsample_t)iSample ),\n                                     pabySrcTile,\n                                     TIFFTileSize(hTIFF));\n            }\n            else\n            {\n                TIFFReadEncodedStrip( hTIFF,\n                                      TIFFComputeStrip(hTIFF, nSYOff,\n                                                       (tsample_t) iSample),\n                                      pabySrcTile,\n                                      TIFFStripSize(hTIFF) );\n            }\n        }\n        for( iOverview = 0; iOverview < nOverviews; iOverview++ )\n        {\n            TIFFOvrCache *poRBI = papoRawBIs[iOverview];\n            unsigned char *pabyOTile;\n            uint32  nTXOff, nTYOff, nOXOff, nOYOff, nOMult;\n            uint32  nOBlockXSize = poRBI->nBlockXSize;\n            uint32  nOBlockYSize = poRBI->nBlockYSize;\n            int     nSkewBits, nSampleByteOffset;\n            nOMult = panOvList[iOverview];\n            nOXOff = (nSXOff/nOMult) / nOBlockXSize;\n            nOYOff = (nSYOff/nOMult) / nOBlockYSize;\n            if( bSubsampled )\n            {\n                pabyOTile = TIFFGetOvrBlock_Subsampled( poRBI, nOXOff, nOYOff );\n                nTXOff = (nSXOff - nOXOff*nOMult*nOBlockXSize) / nOMult;\n                nTYOff = (nSYOff - nOYOff*nOMult*nOBlockYSize) / nOMult;\n#ifdef DBMALLOC\n                malloc_chain_check( 1 );\n#endif\n                TIFF_DownSample_Subsampled( pabySrcTile, iSample,\n                                            nBlockXSize, nBlockYSize,\n                                            pabyOTile,\n                                            poRBI->nBlockXSize, poRBI->nBlockYSize,\n                                            nTXOff, nTYOff,\n                                            nOMult, pszResampling,\n                                            nHorSubsampling, nVerSubsampling );\n#ifdef DBMALLOC\n                malloc_chain_check( 1 );\n#endif\n            }\n            else\n            {\n                pabyOTile = TIFFGetOvrBlock( poRBI, nOXOff, nOYOff, iSample );\n                nTXOff = (nSXOff - nOXOff*nOMult*nOBlockXSize) / nOMult;\n                nTYOff = (nSYOff - nOYOff*nOMult*nOBlockYSize) / nOMult;\n                assert( (nBitsPerPixel % 8) == 0 );\n                if( nPlanarConfig == PLANARCONFIG_SEPARATE )\n                {\n                    nSkewBits = 0;\n                    nSampleByteOffset = 0;\n                }\n                else\n                {\n                    nSkewBits = nBitsPerPixel * (nSamples-1);\n                    nSampleByteOffset = (nBitsPerPixel/8) * iSample;\n                }\n#ifdef DBMALLOC\n                malloc_chain_check( 1 );\n#endif\n                TIFF_DownSample( pabySrcTile + nSampleByteOffset,\n                               nBlockXSize, nBlockYSize,\n                               nSkewBits, nBitsPerPixel, pabyOTile,\n                               poRBI->nBlockXSize, poRBI->nBlockYSize,\n                               nTXOff, nTYOff,\n                               nOMult, nSampleFormat, pszResampling );\n#ifdef DBMALLOC\n                malloc_chain_check( 1 );\n#endif\n            }\n        }\n    }\n}', 'uint32\nTIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tuint32 dx = td->td_tilewidth;\n\tuint32 dy = td->td_tilelength;\n\tuint32 dz = td->td_tiledepth;\n\tuint32 tile = 1;\n\tif (td->td_imagedepth == 1)\n\t\tz = 0;\n\tif (dx == (uint32) -1)\n\t\tdx = td->td_imagewidth;\n\tif (dy == (uint32) -1)\n\t\tdy = td->td_imagelength;\n\tif (dz == (uint32) -1)\n\t\tdz = td->td_imagedepth;\n\tif (dx != 0 && dy != 0 && dz != 0) {\n\t\tuint32 xpt = TIFFhowmany_32(td->td_imagewidth, dx);\n\t\tuint32 ypt = TIFFhowmany_32(td->td_imagelength, dy);\n\t\tuint32 zpt = TIFFhowmany_32(td->td_imagedepth, dz);\n\t\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE)\n\t\t\ttile = (xpt*ypt*zpt)*s +\n\t\t\t     (xpt*ypt)*(z/dz) +\n\t\t\t     xpt*(y/dy) +\n\t\t\t     x/dx;\n\t\telse\n\t\t\ttile = (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx;\n\t}\n\treturn (tile);\n}']