From a2b4dfc83abcc75997d7c0164520541644344076 Mon Sep 17 00:00:00 2001 From: Lee Howard Date: Mon, 15 Jun 2015 16:13:46 +0000 Subject: [PATCH] Attempt to fix Coverity warning: CID 1306634: Integer handling issues (SIGN_EXTENSION) Suspicious implicit sign extension: "img->samplesperpixel" with type "unsigned short" (16 bits, unsigned) is promoted in "img->col_offset * img->samplesperpixel" to type "int" (32 bits, signed), then sign-extended to type "long" (64 bits, signed). If "img->col_offset * img->samplesperpixel" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1. --- libtiff/tif_getimage.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c index 77b2fab8..1095c25e 100644 --- a/libtiff/tif_getimage.c +++ b/libtiff/tif_getimage.c @@ -1,4 +1,4 @@ -/* $Id: tif_getimage.c,v 1.88 2015-06-14 22:14:10 faxguy Exp $ */ +/* $Id: tif_getimage.c,v 1.89 2015-06-15 16:13:46 faxguy Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler @@ -660,7 +660,7 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) break; } pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \ - (fromskew * img->samplesperpixel); + ((int32) fromskew * img->samplesperpixel); if (tocol + this_tw > w) { /* @@ -827,7 +827,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) } pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \ - (fromskew * img->samplesperpixel); + ((int32) fromskew * img->samplesperpixel); if (tocol + this_tw > w) { /* @@ -937,7 +937,7 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) } pos = ((row + img->row_offset) % rowsperstrip) * scanline + \ - (img->col_offset * img->samplesperpixel); + ((int32) img->col_offset * img->samplesperpixel); (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + pos); y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); } @@ -1069,7 +1069,7 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) } pos = ((row + img->row_offset) % rowsperstrip) * scanline + \ - (img->col_offset * img->samplesperpixel); + ((int32) img->col_offset * img->samplesperpixel); (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL)); y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);