From 8aead43028c0320d755f06a7d43dd34e0e709278 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Tue, 26 Apr 2016 14:09:32 +1200 Subject: Add catch for non-positive white value --- pgm-interlace.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 */ if (white > 255) -- cgit v1.1