From ef68c48815bb73888341099fcd41bb2476144783 Mon Sep 17 00:00:00 2001
From: Su_Laus <[EMAIL REDACTED]>
Date: Thu, 13 Oct 2022 20:50:58 +0200
Subject: [PATCH] tiffcrop fix Coverity Scan issues about PRINTF_ARGS.
---
tools/tiffcrop.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index 2232f56e..748c07db 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -933,7 +933,7 @@ static int readContigTilesIntoBuffer (TIFF* in, uint8_t* buf,
{
src_offset = trow * tile_rowsize;
src = tilebuf + src_offset;
- dst_offset = (row + trow) * dst_rowsize;
+ dst_offset = (row + trow) * (tmsize_t)dst_rowsize;
dst = buf + dst_offset + col_offset;
switch (shift_width)
{
@@ -6342,7 +6342,7 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
exit(EXIT_FAILURE);
}
- if (buffsize < (uint32_t)(ntiles * tl * tile_rowsize))
+ if (buffsize < (tmsize_t)(ntiles * tl * tile_rowsize))
{
buffsize = ntiles * tl * tile_rowsize;
if (ntiles != (buffsize / tl / tile_rowsize))
@@ -6360,12 +6360,12 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
if (dump->infile != NULL)
dump_info (dump->infile, dump->format, "",
- "Tilesize: %"PRIu32", Number of Tiles: %"PRIu32", Tile row size: %"PRIu32,
+ "Tilesize: %"TIFF_SSIZE_FORMAT", Number of Tiles: %"PRIu32", Tile row size: %"TIFF_SSIZE_FORMAT,
tlsize, ntiles, tile_rowsize);
}
else
{
- uint32_t buffsize_check;
+ tmsize_t buffsize_check;
readunit = STRIP;
TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
stsize = TIFFStripSize(in);
@@ -6408,7 +6408,7 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
if (dump->infile != NULL)
dump_info (dump->infile, dump->format, "",
- "Stripsize: %"PRIu32", Number of Strips: %"PRIu32", Rows per Strip: %"PRIu32", Scanline size: %"PRIu32,
+ "Stripsize: %"TIFF_SSIZE_FORMAT", Number of Strips: %"PRIu32", Rows per Strip: %"PRIu32", Scanline size: %"TIFF_SSIZE_FORMAT,
stsize, nstrips, rowsperstrip, scanlinesize);
}
@@ -6527,7 +6527,7 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
if ((dump->infile != NULL) && (dump->level == 2))
{
dump_info (dump->infile, dump->format, "loadImage",
- "Image width %"PRIu32", length %"PRIu32", Raw image data, %4"PRIu32" bytes",
+ "Image width %"PRIu32", length %"PRIu32", Raw image data, %4"TIFF_SSIZE_FORMAT" bytes",
width, length, buffsize);
dump_info (dump->infile, dump->format, "",
"Bits per sample %"PRIu16", Samples per pixel %"PRIu16, bps, spp);