Hopefully fix four Coverity issues related to unintended sign extension.

This commit is contained in:
Bob Friesenhahn 2015-06-17 01:34:07 +00:00
parent 39113ade50
commit ac3107ef45
2 changed files with 25 additions and 9 deletions

24
configure vendored
View File

@ -837,6 +837,7 @@ with_jpeg12_include_dir
with_jpeg12_lib with_jpeg12_lib
enable_cxx enable_cxx
with_x with_x
enable_win32_io
enable_strip_chopping enable_strip_chopping
with_default_strip_size with_default_strip_size
enable_defer_strile_load enable_defer_strile_load
@ -1521,6 +1522,8 @@ Optional Features:
--enable-jpeg12 enable libjpeg 8/12bit dual mode --enable-jpeg12 enable libjpeg 8/12bit dual mode
--enable-cxx enable C++ stream API building (requires C++ --enable-cxx enable C++ stream API building (requires C++
compiler) compiler)
--disable-win32-io disable Win32 I/O (Windows only, enabled by default
except for Cygwin)
--disable-strip-chopping --disable-strip-chopping
disable support for strip chopping (whether or not disable support for strip chopping (whether or not
to convert single-strip uncompressed images to to convert single-strip uncompressed images to
@ -20346,19 +20349,32 @@ fi
# Check whether --enable-win32-io was given.
if test "${enable_win32_io+set}" = set; then :
enableval=$enable_win32_io;
fi
win32_io_ok=no win32_io_ok=no
case "${host_os}" in case "${host_os}" in
cygwin*) cygwin*)
if test x"$ac_cv_header_windows_h" = xyes -a "x$enable_win32_io" = xyes ; then
win32_io_ok=yes
fi
;; ;;
*) *)
if test x"$ac_cv_header_windows_h" = xyes; then if test x"$ac_cv_header_windows_h" = xyes -a ! "x$enable_win32_io" = xno ; then
win32_io_ok=yes win32_io_ok=yes
$as_echo "#define USE_WIN32_FILEIO 1" >>confdefs.h
fi fi
;; ;;
esac esac
if test "$win32_io_ok" = "yes" ; then
$as_echo "#define USE_WIN32_FILEIO 1" >>confdefs.h
fi
if test "$win32_io_ok" = yes; then if test "$win32_io_ok" = yes; then
WIN32_IO_TRUE= WIN32_IO_TRUE=
WIN32_IO_FALSE='#' WIN32_IO_FALSE='#'

View File

@ -1,4 +1,4 @@
/* $Id: tif_getimage.c,v 1.89 2015-06-15 16:13:46 faxguy Exp $ */ /* $Id: tif_getimage.c,v 1.90 2015-06-17 01:34:08 bfriesen 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) + \
((int32) fromskew * img->samplesperpixel); ((tmsize_t) 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) + \
((int32) fromskew * img->samplesperpixel); ((tmsize_t) 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 + \
((int32) img->col_offset * img->samplesperpixel); ((tmsize_t) 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 + \
((int32) img->col_offset * img->samplesperpixel); ((tmsize_t) 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);