From ac3107ef45c5d856be759437493e6690ef29f6b1 Mon Sep 17 00:00:00 2001 From: Bob Friesenhahn Date: Wed, 17 Jun 2015 01:34:07 +0000 Subject: [PATCH] Hopefully fix four Coverity issues related to unintended sign extension. --- configure | 24 ++++++++++++++++++++---- libtiff/tif_getimage.c | 10 +++++----- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 3f63cd86..ef72e024 100755 --- a/configure +++ b/configure @@ -837,6 +837,7 @@ with_jpeg12_include_dir with_jpeg12_lib enable_cxx with_x +enable_win32_io enable_strip_chopping with_default_strip_size enable_defer_strile_load @@ -1521,6 +1522,8 @@ Optional Features: --enable-jpeg12 enable libjpeg 8/12bit dual mode --enable-cxx enable C++ stream API building (requires C++ compiler) + --disable-win32-io disable Win32 I/O (Windows only, enabled by default + except for Cygwin) --disable-strip-chopping disable support for strip chopping (whether or not 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 case "${host_os}" in 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 - -$as_echo "#define USE_WIN32_FILEIO 1" >>confdefs.h - fi ;; 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 WIN32_IO_TRUE= WIN32_IO_FALSE='#' diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c index 1095c25e..f49b73fd 100644 --- a/libtiff/tif_getimage.c +++ b/libtiff/tif_getimage.c @@ -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 @@ -660,7 +660,7 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h) break; } pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \ - ((int32) fromskew * img->samplesperpixel); + ((tmsize_t) 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) + \ - ((int32) fromskew * img->samplesperpixel); + ((tmsize_t) 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 + \ - ((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); 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 + \ - ((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, p2 + pos, (alpha?(pa+pos):NULL)); y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);