From a48c640a01ca3dbdac00212eaa4245fd9908ce87 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 11 Jan 2017 16:38:26 +0000 Subject: [PATCH] =?UTF-8?q?*=20libtiff/tif=5Fgetimage.c:=20add=20explicit?= =?UTF-8?q?=20uint32=20cast=20in=20putagreytile=20to=20avoid=20UndefinedBe?= =?UTF-8?q?haviorSanitizer=20warning.=20Patch=20by=20Nicol=C3=A1s=20Pe?= =?UTF-8?q?=C3=B1a.=20Fixes=20http://bugzilla.maptools.org/show=5Fbug.cgi?= =?UTF-8?q?=3Fid=3D2658?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 7 +++++++ libtiff/tif_getimage.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e314644..6a342e5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-01-11 Even Rouault + + * libtiff/tif_getimage.c: add explicit uint32 cast in putagreytile to + avoid UndefinedBehaviorSanitizer warning. + Patch by Nicolás Peña. + Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2658 + 2017-01-11 Even Rouault * libtiff/tif_read.c: avoid potential undefined behaviour on signed integer diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c index 2ea83855..52a2402f 100644 --- a/libtiff/tif_getimage.c +++ b/libtiff/tif_getimage.c @@ -1,4 +1,4 @@ -/* $Id: tif_getimage.c,v 1.101 2016-12-18 22:28:42 erouault Exp $ */ +/* $Id: tif_getimage.c,v 1.102 2017-01-11 16:38:26 erouault Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler @@ -1302,7 +1302,7 @@ DECLAREContigPutFunc(putagreytile) while (h-- > 0) { for (x = w; x-- > 0;) { - *cp++ = BWmap[*pp][0] & (*(pp+1) << 24 | ~A1); + *cp++ = BWmap[*pp][0] & ((uint32)*(pp+1) << 24 | ~A1); pp += samplesperpixel; } cp += toskew;