aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <dbphillipsnz@gmail.com>2016-04-26 14:09:32 +1200
committerDavid Phillips <dbphillipsnz@gmail.com>2016-04-26 14:18:27 +1200
commit8aead43028c0320d755f06a7d43dd34e0e709278 (patch)
treeab55b9a9318173713a6aad46530c4de27e40b337
parent410ed2005be52bceb57fcad26919bdac6171de5b (diff)
downloadpgm-interlace-8aead43028c0320d755f06a7d43dd34e0e709278.tar.xz
Add catch for non-positive white value
-rw-r--r--pgm-interlace.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pgm-interlace.c b/pgm-interlace.c
index 861f30b..21226a7 100644
--- a/pgm-interlace.c
+++ b/pgm-interlace.c
@@ -45,6 +45,12 @@ int check_sanity(long width, long height, long white, unsigned int clust_total)
return 1;
}
+ if (white <= 0)
+ {
+ fprintf(stderr, "white value must be positive\n");
+ return 1;
+ }
+
/* FIXME only support single-byte pixels, PGM supports 16-bit according
* to <http://netpbm.sourceforge.net/doc/pgm.html> */
if (white > 255)