summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorerouault <erouault>2016-08-15 21:26:56 +0000
committererouault <erouault>2016-08-15 21:26:56 +0000
commit225ac3c583324b6781200683c6c54d6afced55a7 (patch)
treef15b7f6ffaf9392f05fd77dbb2d806047f7f9d87 /tools
parent8e7727e0b15c969be8983b3f8693c02a5e0f60a9 (diff)
downloadlibtiff-225ac3c583324b6781200683c6c54d6afced55a7.tar.gz
* tools/rgb2ycbcr.c: validate values of -v and -h parameters to
avoid potential divide by zero. Fixes CVE-2016-3623 (bugzilla #2569)
Diffstat (limited to 'tools')
-rw-r--r--tools/rgb2ycbcr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/rgb2ycbcr.c b/tools/rgb2ycbcr.c
index 4a969c2c..7a9d705e 100644
--- a/tools/rgb2ycbcr.c
+++ b/tools/rgb2ycbcr.c
@@ -1,4 +1,4 @@
-/* $Id: rgb2ycbcr.c,v 1.16 2015-06-21 01:09:10 bfriesen Exp $ */
+/* $Id: rgb2ycbcr.c,v 1.17 2016-08-15 21:26:56 erouault Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -95,9 +95,13 @@ main(int argc, char* argv[])
break;
case 'h':
horizSubSampling = atoi(optarg);
+ if( horizSubSampling != 1 && horizSubSampling != 2 && horizSubSampling != 4 )
+ usage(-1);
break;
case 'v':
vertSubSampling = atoi(optarg);
+ if( vertSubSampling != 1 && vertSubSampling != 2 && vertSubSampling != 4 )
+ usage(-1);
break;
case 'r':
rowsperstrip = atoi(optarg);