From 813baea7a7bc28986e474541dd1080898fac14d7 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 1 Jan 2019 15:04:05 +0100 Subject: [PATCH] img2txt: reject pictures with 0 bits per plane. Fixes: #42 --- src/common-image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common-image.c b/src/common-image.c index e4309bc..43e756c 100644 --- a/src/common-image.c +++ b/src/common-image.c @@ -153,7 +153,7 @@ struct image * load_image(char const * name) uint32_t depth = (bpp + 7) / 8; /* Sanity check */ - if (!im->w || im->w > 0x10000 || !im->h || im->h > 0x10000 || planes != 1) + if (!depth || !im->w || im->w > 0x10000 || !im->h || im->h > 0x10000 || planes != 1) { caca_file_close(f); free(im);