* 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
This commit is contained in:
Even Rouault 2017-01-11 16:38:26 +00:00
parent 50b48786d5
commit a48c640a01
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2017-01-11 Even Rouault <even.rouault at spatialys.com>
* 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 <even.rouault at spatialys.com> 2017-01-11 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_read.c: avoid potential undefined behaviour on signed integer * libtiff/tif_read.c: avoid potential undefined behaviour on signed integer

View File

@ -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 * Copyright (c) 1991-1997 Sam Leffler
@ -1302,7 +1302,7 @@ DECLAREContigPutFunc(putagreytile)
while (h-- > 0) { while (h-- > 0) {
for (x = w; x-- > 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; pp += samplesperpixel;
} }
cp += toskew; cp += toskew;