summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorerouault <erouault>2016-08-15 22:01:31 +0000
committererouault <erouault>2016-08-15 22:01:31 +0000
commitb93faea38b674000aefe18e6df15265ccb146df1 (patch)
tree565bfd7aae1ff58f923c7152244ecd4249931172 /tools
parent948b174b5c17118c433c65a36f813078ac259c8e (diff)
downloadlibtiff-b93faea38b674000aefe18e6df15265ccb146df1.tar.gz
* tools/tiff2bw.c: fix weight computation that could result of color
value overflow (no security implication). Fix bugzilla #2550. Patch by Frank Freudenberg.
Diffstat (limited to 'tools')
-rw-r--r--tools/tiff2bw.c4
1 files changed, 2 insertions, 2 deletions
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% */