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.
This commit is contained in:
parent
74d1dfd161
commit
a2b4dfc83a
@ -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
|
* Copyright (c) 1991-1997 Sam Leffler
|
||||||
@ -660,7 +660,7 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \
|
pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \
|
||||||
(fromskew * img->samplesperpixel);
|
((int32) fromskew * img->samplesperpixel);
|
||||||
if (tocol + this_tw > w)
|
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) + \
|
pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \
|
||||||
(fromskew * img->samplesperpixel);
|
((int32) fromskew * img->samplesperpixel);
|
||||||
if (tocol + this_tw > w)
|
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 + \
|
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);
|
(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + pos);
|
||||||
y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
|
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 + \
|
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,
|
(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, p0 + pos, p1 + pos,
|
||||||
p2 + pos, (alpha?(pa+pos):NULL));
|
p2 + pos, (alpha?(pa+pos):NULL));
|
||||||
y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
|
y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
|
||||||
|
Loading…
Reference in New Issue
Block a user