summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2023-01-12 21:42:55 +0000
committerEven Rouault <even.rouault@spatialys.com>2023-01-12 21:42:55 +0000
commit6be14e882f36db6386de1517edc2b25aa0626942 (patch)
tree678082ffc7e28f6573d2b68652583259c3613381
parentc0f031693193c9216575ac48670eee6993d381c9 (diff)
parent3c774f1903062eb53ae06274f56e521a925ba996 (diff)
downloadlibtiff-git-6be14e882f36db6386de1517edc2b25aa0626942.tar.gz
Merge branch 'tiffmedian_fix_#477' into 'master'
tiffmedian: avoid zero num_colors, fixes #477 Closes #477 See merge request libtiff/libtiff!458
-rw-r--r--tools/tiffmedian.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/tiffmedian.c b/tools/tiffmedian.c
index 8225970c..334566a4 100644
--- a/tools/tiffmedian.c
+++ b/tools/tiffmedian.c
@@ -144,10 +144,15 @@ int main(int argc, char *argv[])
num_colors = atoi(optarg);
if (num_colors > MAX_CMAP_SIZE)
{
- fprintf(stderr, "-c: colormap too big, max %d\n",
+ fprintf(stderr, "-C: colormap too big, max %d\n",
MAX_CMAP_SIZE);
usage(EXIT_FAILURE);
}
+ if (num_colors < 2)
+ {
+ fprintf(stderr, "-C: colormap too small, min %d\n", 2);
+ usage(EXIT_FAILURE);
+ }
break;
case 'f': /* dither */
dither = 1;