diff --git a/ChangeLog b/ChangeLog index 3e6642a3..ae66e531 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-08-15 Even Rouault + + * tools/tiff2bw.c: fix weight computation that could result of color + value overflow (no security implication). Fix bugzilla #2550. + Patch by Frank Freudenberg. + 2016-08-15 Even Rouault * tools/rgb2ycbcr.c: validate values of -v and -h parameters to diff --git a/tools/tiff2bw.c b/tools/tiff2bw.c index 7464cf1e..743f455c 100644 --- a/tools/tiff2bw.c +++ b/tools/tiff2bw.c @@ -1,4 +1,4 @@ -/* $Id: tiff2bw.c,v 1.18 2015-06-21 01:09:10 bfriesen Exp $ */ +/* $Id: tiff2bw.c,v 1.19 2016-08-15 22:01:31 erouault Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -45,7 +45,7 @@ #define strneq(a,b,n) (strncmp(a,b,n) == 0) /* x% weighting -> fraction of full color */ -#define PCT(x) (((x)*255+127)/100) +#define PCT(x) (((x)*256+50)/100) int RED = PCT(30); /* 30% */ int GREEN = PCT(59); /* 59% */ int BLUE = PCT(11); /* 11% */