tools/tiffcrop.c:6905: error: Buffer Overrun L3
  Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, +oo] by call to `writeCroppedImage`.

tools/tiffcrop.c:6886:1: Parameter `(*out)->tif_dir.td_samplesperpixel`
6884.   } /* end extractImageSection */
6885. 
6886. static int 
      ^
6887. writeSelections(TIFF *in, TIFF **out, struct crop_mask *crop, 
6888.                 struct image_data *image, struct dump_opts *dump,

tools/tiffcrop.c:6902:14: Call
6900.          autoindex = 0;
6901.          crop_buff = seg_buffs[0].buffer;
6902.          if (update_output_file (out, mp, autoindex, filename, page))
                   ^
6903.            return (1);
6904.          page_count = total_pages;

tools/tiffcrop.c:2111:1: Parameter `(*tiffout)->tif_dir.td_samplesperpixel`
  2109.  * so TIFFTAG PAGENUM will be correct in image.
  2110.  */
  2111. static int 
        ^
  2112. update_output_file (TIFF **tiffout, char *mode, int autoindex,
  2113.                     char *outname, unsigned int *page)

tools/tiffcrop.c:6905:14: Call
6903.            return (1);
6904.          page_count = total_pages;
6905.          if (writeCroppedImage(in, *out, image, dump,
                   ^
6906.                                crop->combined_width, 
6907.                                crop->combined_length,

tools/tiffcrop.c:7729:1: Parameter `out->tif_dir.td_samplesperpixel`
  7727.  * then passed in as an argument.
  7728.  */
  7729. static int  
        ^
  7730. writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image, 
  7731.                   struct dump_opts *dump, uint32 width, uint32 length, 

tools/tiffcrop.c:7986:11: Call
  7984.     if (config == PLANARCONFIG_CONTIG)
  7985.       {
  7986.       if (writeBufferToContigStrips (out, crop_buff, length))
                  ^
  7987.         TIFFError("","Unable to write contiguous strip data for page %d", pagenum);
  7988.       }

tools/tiffcrop.c:1119:1: Parameter `out->tif_dir.td_samplesperpixel`
    1117.   }
    1118. 
    1119. static int writeBufferToContigStrips(TIFF* out, uint8* buf, uint32 imagelength)
          ^
    1120.   {
    1121.   uint32 row, nrows, rowsperstrip;

tools/tiffcrop.c:1125:3: Call
    1123.   tsize_t stripsize;
    1124. 
    1125.   TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
            ^
    1126.   for (row = 0; row < imagelength; row += rowsperstrip)
    1127.     {

libtiff/tif_aux.c:309:1: Parameter `tif->tif_dir.td_samplesperpixel`
      307.  * value if the tag is not present in the directory.
      308.  */
      309. int
           ^
      310. TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...)
      311. {

libtiff/tif_aux.c:316:8: Call
      314. 
      315. 	va_start(ap, tag);
      316. 	ok =  TIFFVGetFieldDefaulted(tif, tag, ap);
                  ^
      317. 	va_end(ap);
      318. 	return (ok);

libtiff/tif_aux.c:173:1: Parameter `tif->tif_dir.td_extrasamples`
        171.  *	place in the library -- in TIFFDefaultDirectory.
        172.  */
        173. int
             ^
        174. TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap)
        175. {

tools/tiffcrop.c:7996:8: Call
  7994.     }
  7995. 
  7996.   if (!TIFFWriteDirectory(out))
               ^
  7997.     {
  7998.     TIFFError("","Failed to write IFD for page number %d", pagenum);

libtiff/tif_dirwrite.c:181:1: Parameter `tif->tif_dir.td_samplesperpixel`
    179.  * storage that's been changed.
    180.  */
    181. int
         ^
    182. TIFFWriteDirectory(TIFF* tif)
    183. {

libtiff/tif_dirwrite.c:184:9: Call
    182. TIFFWriteDirectory(TIFF* tif)
    183. {
    184. 	return TIFFWriteDirectorySec(tif,TRUE,TRUE,NULL);
                 ^
    185. }
    186. 

libtiff/tif_dirwrite.c:363:1: Parameter `tif->tif_dir.td_samplesperpixel`
      361. }
      362. 
      363. static int
           ^
      364. TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
      365. {

libtiff/tif_dirwrite.c:590:10: Call
      588. 			if (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE))
      589. 			{
      590. 				if (!TIFFWriteDirectoryTagSampleformatArray(tif,&ndir,dir,TIFFTAG_SMINSAMPLEVALUE,tif->tif_dir.td_samplesperpixel,tif->tif_dir.td_sminsamplevalue))
                    ^
      591. 					goto bad;
      592. 			}

libtiff/tif_dirwrite.c:1011:1: Parameter `count`
        1009. }
        1010. 
        1011. static int
              ^
        1012. TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value)
        1013. {

libtiff/tif_dirwrite.c:1018:9: Call
        1016. 	uint32 i;
        1017. 	int ok;
        1018. 	conv = _TIFFmalloc(count*sizeof(double));
                      ^
        1019. 	if (conv == NULL)
        1020. 	{

libtiff/tif_unix.c:314:17: Assignment
          312. {
          313.         if (s == 0)
          314.                 return ((void *) NULL);
                               ^
          315. 
          316. 	return (malloc((size_t) s));

libtiff/tif_dirwrite.c:1018:2: Assignment
        1016. 	uint32 i;
        1017. 	int ok;
        1018. 	conv = _TIFFmalloc(count*sizeof(double));
               ^
        1019. 	if (conv == NULL)
        1020. 	{

libtiff/tif_dirwrite.c:1056:10: Call
        1054. 				for (i = 0; i < count; ++i)
        1055. 					((int32*)conv)[i] = TIFFClampDoubleToInt32(value[i]);
        1056. 				ok = TIFFWriteDirectoryTagSlongArray(tif,ndir,dir,tag,count,(int32*)conv);
                       ^
        1057. 			}
        1058. 			break;

libtiff/tif_dirwrite.c:1407:1: Parameter `*value`
          1405. #endif
          1406. 
          1407. static int
                ^
          1408. TIFFWriteDirectoryTagSlongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int32* value)
          1409. {

libtiff/tif_dirwrite.c:1415:9: Call
          1413. 		return(1);
          1414. 	}
          1415. 	return(TIFFWriteDirectoryTagCheckedSlongArray(tif,ndir,dir,tag,count,value));
                        ^
          1416. }
          1417. 

libtiff/tif_dirwrite.c:2110:1: Parameter `*value`
            2108. #endif
            2109. 
            2110. static int
                  ^
            2111. TIFFWriteDirectoryTagCheckedSlongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int32* value)
            2112. {

libtiff/tif_dirwrite.c:2116:3: Call
            2114. 	assert(sizeof(int32)==4);
            2115. 	if (tif->tif_flags&TIFF_SWAB)
            2116. 		TIFFSwabArrayOfLong((uint32*)value,count);
                    ^
            2117. 	return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SLONG,count,count*4,value));
            2118. }

libtiff/tif_swab.c:104:1: <Length trace>
102. 
103. #if defined(DISABLE_CHECK_TIFFSWABMACROS) || !defined(TIFFSwabArrayOfLong)
104. void
     ^
105. TIFFSwabArrayOfLong(register uint32* lp, tmsize_t n)
106. {

libtiff/tif_swab.c:104:1: Parameter `*lp`
              102. 
              103. #if defined(DISABLE_CHECK_TIFFSWABMACROS) || !defined(TIFFSwabArrayOfLong)
              104. void
                   ^
              105. TIFFSwabArrayOfLong(register uint32* lp, tmsize_t n)
              106. {

libtiff/tif_swab.c:112:3: Assignment
              110. 	/* XXX unroll loop some */
              111. 	while (n-- > 0) {
              112. 		cp = (unsigned char *)lp;
                     ^
              113. 		t = cp[3]; cp[3] = cp[0]; cp[0] = t;
              114. 		t = cp[2]; cp[2] = cp[1]; cp[1] = t;

libtiff/tif_swab.c:113:7: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, +oo] by call to `writeCroppedImage` 
              111. 	while (n-- > 0) {
              112. 		cp = (unsigned char *)lp;
              113. 		t = cp[3]; cp[3] = cp[0]; cp[0] = t;
                         ^
              114. 		t = cp[2]; cp[2] = cp[1]; cp[1] = t;
              115. 		lp++;
