* tools/tiff2bw.c: fix weight computation that could result of color

value overflow (no security implication). Fix bugzilla #2550.
Patch by Frank Freudenberg.
This commit is contained in:
Even Rouault 2016-08-15 22:01:31 +00:00
parent ee80566cd1
commit ac16d2213c
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2016-08-15 Even Rouault <even.rouault at spatialys.com>
* 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 <even.rouault at spatialys.com>
* tools/rgb2ycbcr.c: validate values of -v and -h parameters to

View File

@ -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% */