From 704f717cf5eceb70d6eca3840776c2c6ee857250 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 31 Aug 2015 15:05:57 +0000 Subject: [PATCH] * libtiff/tif_predict.c: pedantic change to add explicit masking with 0xff before casting to uchar in floating-point horizontal differencing and accumulation routines. --- ChangeLog | 6 ++++++ libtiff/tif_predict.c | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5db95cf3..1933ae42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-08-31 Even Rouault + + * libtiff/tif_predict.c: pedantic change to add explicit masking + with 0xff before casting to uchar in floating-point horizontal + differencing and accumulation routines. + 2015-08-31 Even Rouault * libtiff/tif_predict.c: fix generation of output with 16 bit diff --git a/libtiff/tif_predict.c b/libtiff/tif_predict.c index b4fc5045..1388dde5 100644 --- a/libtiff/tif_predict.c +++ b/libtiff/tif_predict.c @@ -1,4 +1,4 @@ -/* $Id: tif_predict.c,v 1.34 2015-08-31 14:36:10 erouault Exp $ */ +/* $Id: tif_predict.c,v 1.35 2015-08-31 15:05:57 erouault Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -389,7 +389,8 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc) return; while (count > stride) { - REPEAT4(stride, cp[stride] += cp[0]; cp++) + REPEAT4(stride, cp[stride] = + (unsigned char) ((cp[stride] + cp[0]) & 0xff); cp++) count -= stride; } @@ -602,7 +603,7 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc) cp = (uint8 *) cp0; cp += cc - stride - 1; for (count = cc; count > stride; count -= stride) - REPEAT4(stride, cp[stride] -= cp[0]; cp--) + REPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--) } static int