tools/tiffgt.c:209: error: Integer Overflow L2
  ([0, 4294967294] + [0, 4294967294]):unsigned32 by call to `TIFFClose`.

tools/tiffgt.c:209:17: Call
207.                 _TIFFfree(raster);
208.         if (tif != NULL)
209.                 TIFFClose(tif);
                     ^
210.         exit(0);
211. }

libtiff/tif_close.c:120:1: Parameter `tif->tif_dir.td_imagewidth`
  118.  */
  119. 
  120. void
       ^
  121. TIFFClose(TIFF* tif)
  122. {

libtiff/tif_close.c:126:2: Call
  124. 	thandle_t fd = tif->tif_clientdata;
  125. 
  126. 	TIFFCleanup(tif);
        ^
  127. 	(void) (*closeproc)(fd);
  128. }

libtiff/tif_close.c:44:1: Parameter `tif->tif_dir.td_imagewidth`
    42.  */
    43. 
    44. void
        ^
    45. TIFFCleanup(TIFF* tif)
    46. {

libtiff/tif_close.c:51:3: Call
    49.          */
    50. 	if (tif->tif_mode != O_RDONLY)
    51. 		TIFFFlush(tif);
          ^
    52. 	(*tif->tif_cleanup)(tif);
    53. 	TIFFFreeDirectory(tif);

libtiff/tif_flush.c:30:1: Parameter `tif->tif_dir.td_imagewidth`
      28. #include "tiffiop.h"
      29. 
      30. int
          ^
      31. TIFFFlush(TIFF* tif)
      32. {

libtiff/tif_flush.c:48:13: Call
      46.         && tif->tif_mode == O_RDWR )
      47.     {
      48.         if( TIFFForceStrileArrayWriting(tif) )
                      ^
      49.             return 1;
      50.     }

libtiff/tif_flush.c:78:1: Parameter `tif->tif_dir.td_imagewidth`
        76.  * Returns 1 in case of success, 0 otherwise.
        77.  */
        78. int TIFFForceStrileArrayWriting(TIFF* tif)
            ^
        79. {
        80.     static const char module[] = "TIFFForceStrileArrayWriting";

libtiff/tif_flush.c:120:55: Call
        118.         }
        119. 
        120.         if (tif->tif_dir.td_stripoffset_p == NULL && !TIFFSetupStrips(tif))
                                                                   ^
        121.             return 0;
        122.     }

libtiff/tif_write.c:522:1: Parameter `tif->tif_dir.td_imagewidth`
          520.     (TIFFFieldSet(tif,f) && (tif)->tif_dir.td_imagelength == 0)
          521. 
          522. int
               ^
          523. TIFFSetupStrips(TIFF* tif)
          524. {

libtiff/tif_write.c:530:29: Call
          528. 		td->td_stripsperimage =
          529. 		    isUnspecified(tif, FIELD_TILEDIMENSIONS) ?
          530. 			td->td_samplesperpixel : TIFFNumberOfTiles(tif);
                                           ^
          531. 	else
          532. 		td->td_stripsperimage =

libtiff/tif_tile.c:112:1: <LHS trace>
110.  * Compute how many tiles are in an image.
111.  */
112. uint32
     ^
113. TIFFNumberOfTiles(TIFF* tif)
114. {

libtiff/tif_tile.c:112:1: Parameter `tif->tif_dir.td_imagewidth`
            110.  * Compute how many tiles are in an image.
            111.  */
            112. uint32
                 ^
            113. TIFFNumberOfTiles(TIFF* tif)
            114. {

libtiff/tif_tile.c:112:1: <RHS trace>
110.  * Compute how many tiles are in an image.
111.  */
112. uint32
     ^
113. TIFFNumberOfTiles(TIFF* tif)
114. {

libtiff/tif_tile.c:112:1: Parameter `tif->tif_dir.td_imagewidth`
            110.  * Compute how many tiles are in an image.
            111.  */
            112. uint32
                 ^
            113. TIFFNumberOfTiles(TIFF* tif)
            114. {

libtiff/tif_tile.c:128:48: Binary operation: ([0, 4294967294] + [0, 4294967294]):unsigned32 by call to `TIFFClose` 
            126. 		dz = td->td_imagedepth;
            127. 	ntiles = (dx == 0 || dy == 0 || dz == 0) ? 0 :
            128. 	    _TIFFMultiply32(tif, _TIFFMultiply32(tif, TIFFhowmany_32(td->td_imagewidth, dx),
                                                                ^
            129. 	    TIFFhowmany_32(td->td_imagelength, dy),
            130. 	    "TIFFNumberOfTiles"),

uint32
TIFFNumberOfTiles(TIFF* tif)
{
	TIFFDirectory *td = &tif->tif_dir;
	uint32 dx = td->td_tilewidth;
	uint32 dy = td->td_tilelength;
	uint32 dz = td->td_tiledepth;
	uint32 ntiles;
	if (dx == (uint32) -1)
		dx = td->td_imagewidth;
	if (dy == (uint32) -1)
		dy = td->td_imagelength;
	if (dz == (uint32) -1)
		dz = td->td_imagedepth;
	ntiles = (dx == 0 || dy == 0 || dz == 0) ? 0 :
	    _TIFFMultiply32(tif, _TIFFMultiply32(tif, TIFFhowmany_32(td->td_imagewidth, dx),
	    TIFFhowmany_32(td->td_imagelength, dy),
	    "TIFFNumberOfTiles"),
	    TIFFhowmany_32(td->td_imagedepth, dz), "TIFFNumberOfTiles");
	if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
		ntiles = _TIFFMultiply32(tif, ntiles, td->td_samplesperpixel,
		    "TIFFNumberOfTiles");
	return (ntiles);
}
['static void\ncleanup_and_exit(void)\n{\n        TIFFRGBAImageEnd(&img);\n        if (filelist != NULL)\n                _TIFFfree(filelist);\n        if (raster != NULL)\n                _TIFFfree(raster);\n        if (tif != NULL)\n                TIFFClose(tif);\n        exit(0);\n}', 'void\nTIFFClose(TIFF* tif)\n{\n\tTIFFCloseProc closeproc = tif->tif_closeproc;\n\tthandle_t fd = tif->tif_clientdata;\n\tTIFFCleanup(tif);\n\t(void) (*closeproc)(fd);\n}', 'void\nTIFFCleanup(TIFF* tif)\n{\n\tif (tif->tif_mode != O_RDONLY)\n\t\tTIFFFlush(tif);\n\t(*tif->tif_cleanup)(tif);\n\tTIFFFreeDirectory(tif);\n\tif (tif->tif_dirlist)\n\t\t_TIFFfree(tif->tif_dirlist);\n\twhile( tif->tif_clientinfo )\n\t{\n\t\tTIFFClientInfoLink *psLink = tif->tif_clientinfo;\n\t\ttif->tif_clientinfo = psLink->next;\n\t\t_TIFFfree( psLink->name );\n\t\t_TIFFfree( psLink );\n\t}\n\tif (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER))\n\t\t_TIFFfree(tif->tif_rawdata);\n\tif (isMapped(tif))\n\t\tTIFFUnmapFileContents(tif, tif->tif_base, (toff_t)tif->tif_size);\n\tif (tif->tif_fields && tif->tif_nfields > 0) {\n\t\tuint32 i;\n\t\tfor (i = 0; i < tif->tif_nfields; i++) {\n\t\t\tTIFFField *fld = tif->tif_fields[i];\n\t\t\tif (fld->field_bit == FIELD_CUSTOM &&\n\t\t\t    strncmp("Tag ", fld->field_name, 4) == 0) {\n\t\t\t\t_TIFFfree(fld->field_name);\n\t\t\t\t_TIFFfree(fld);\n\t\t\t}\n\t\t}\n\t\t_TIFFfree(tif->tif_fields);\n\t}\n        if (tif->tif_nfieldscompat > 0) {\n                uint32 i;\n                for (i = 0; i < tif->tif_nfieldscompat; i++) {\n                        if (tif->tif_fieldscompat[i].allocated_size)\n                                _TIFFfree(tif->tif_fieldscompat[i].fields);\n                }\n                _TIFFfree(tif->tif_fieldscompat);\n        }\n\t_TIFFfree(tif);\n}', 'int\nTIFFFlush(TIFF* tif)\n{\n    if( tif->tif_mode == O_RDONLY )\n        return 1;\n    if (!TIFFFlushData(tif))\n        return (0);\n    if( (tif->tif_flags & TIFF_DIRTYSTRIP)\n        && !(tif->tif_flags & TIFF_DIRTYDIRECT)\n        && tif->tif_mode == O_RDWR )\n    {\n        if( TIFFForceStrileArrayWriting(tif) )\n            return 1;\n    }\n    if ((tif->tif_flags & (TIFF_DIRTYDIRECT|TIFF_DIRTYSTRIP))\n        && !TIFFRewriteDirectory(tif))\n        return (0);\n    return (1);\n}', 'int TIFFForceStrileArrayWriting(TIFF* tif)\n{\n    static const char module[] = "TIFFForceStrileArrayWriting";\n    const int isTiled = TIFFIsTiled(tif);\n    if (tif->tif_mode == O_RDONLY)\n    {\n        TIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n                     "File opened in read-only mode");\n        return 0;\n    }\n    if( tif->tif_diroff == 0 )\n    {\n        TIFFErrorExt(tif->tif_clientdata, module,\n                     "Directory has not yet been written");\n        return 0;\n    }\n    if( (tif->tif_flags & TIFF_DIRTYDIRECT) != 0 )\n    {\n        TIFFErrorExt(tif->tif_clientdata, module,\n                     "Directory has changes other than the strile arrays. "\n                     "TIFFRewriteDirectory() should be called instead");\n        return 0;\n    }\n    if( !(tif->tif_flags & TIFF_DIRTYSTRIP) )\n    {\n        if( !(tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 &&\n             tif->tif_dir.td_stripoffset_entry.tdir_count == 0 &&\n             tif->tif_dir.td_stripoffset_entry.tdir_type == 0 &&\n             tif->tif_dir.td_stripoffset_entry.tdir_offset.toff_long8 == 0 &&\n             tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0 &&\n             tif->tif_dir.td_stripbytecount_entry.tdir_count == 0 &&\n             tif->tif_dir.td_stripbytecount_entry.tdir_type == 0 &&\n             tif->tif_dir.td_stripbytecount_entry.tdir_offset.toff_long8 == 0) )\n        {\n            TIFFErrorExt(tif->tif_clientdata, module,\n                        "Function not called together with "\n                        "TIFFDeferStrileArrayWriting()");\n            return 0;\n        }\n        if (tif->tif_dir.td_stripoffset_p == NULL && !TIFFSetupStrips(tif))\n            return 0;\n    }\n    if( _TIFFRewriteField( tif,\n                           isTiled ? TIFFTAG_TILEOFFSETS :\n                                     TIFFTAG_STRIPOFFSETS,\n                           TIFF_LONG8,\n                           tif->tif_dir.td_nstrips,\n                           tif->tif_dir.td_stripoffset_p )\n        && _TIFFRewriteField( tif,\n                              isTiled ? TIFFTAG_TILEBYTECOUNTS :\n                                        TIFFTAG_STRIPBYTECOUNTS,\n                              TIFF_LONG8,\n                              tif->tif_dir.td_nstrips,\n                              tif->tif_dir.td_stripbytecount_p ) )\n    {\n        tif->tif_flags &= ~TIFF_DIRTYSTRIP;\n        tif->tif_flags &= ~TIFF_BEENWRITING;\n        return 1;\n    }\n    return 0;\n}', 'int\nTIFFSetupStrips(TIFF* tif)\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\tif (isTiled(tif))\n\t\ttd->td_stripsperimage =\n\t\t    isUnspecified(tif, FIELD_TILEDIMENSIONS) ?\n\t\t\ttd->td_samplesperpixel : TIFFNumberOfTiles(tif);\n\telse\n\t\ttd->td_stripsperimage =\n\t\t    isUnspecified(tif, FIELD_ROWSPERSTRIP) ?\n\t\t\ttd->td_samplesperpixel : TIFFNumberOfStrips(tif);\n\ttd->td_nstrips = td->td_stripsperimage;\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE)\n\t\ttd->td_stripsperimage /= td->td_samplesperpixel;\n\ttd->td_stripoffset_p = (uint64 *)\n            _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64),\n                             "for \\"StripOffsets\\" array");\n\ttd->td_stripbytecount_p = (uint64 *)\n            _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64),\n                             "for \\"StripByteCounts\\" array");\n\tif (td->td_stripoffset_p == NULL || td->td_stripbytecount_p == NULL)\n\t\treturn (0);\n\t_TIFFmemset(td->td_stripoffset_p, 0, td->td_nstrips*sizeof (uint64));\n\t_TIFFmemset(td->td_stripbytecount_p, 0, td->td_nstrips*sizeof (uint64));\n\tTIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);\n\tTIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);\n\treturn (1);\n}', 'uint32\nTIFFNumberOfTiles(TIFF* tif)\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 ntiles;\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\tntiles = (dx == 0 || dy == 0 || dz == 0) ? 0 :\n\t    _TIFFMultiply32(tif, _TIFFMultiply32(tif, TIFFhowmany_32(td->td_imagewidth, dx),\n\t    TIFFhowmany_32(td->td_imagelength, dy),\n\t    "TIFFNumberOfTiles"),\n\t    TIFFhowmany_32(td->td_imagedepth, dz), "TIFFNumberOfTiles");\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE)\n\t\tntiles = _TIFFMultiply32(tif, ntiles, td->td_samplesperpixel,\n\t\t    "TIFFNumberOfTiles");\n\treturn (ntiles);\n}']