From 0957fd69eeb86ca9a4ca6801b7a87f37bd644d09 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 31 Mar 2022 21:38:00 -0700 Subject: [PATCH] tiffdec: add grayscale support the file is always decoded to RGBA, so just the samples_per_px needed an update Bug: webp:563 Change-Id: I95d95c3b9e45dc8ecb2223f89f4ba791f0b21e8b --- imageio/tiffdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imageio/tiffdec.c b/imageio/tiffdec.c index 9c71bc65..d711fa4b 100644 --- a/imageio/tiffdec.c +++ b/imageio/tiffdec.c @@ -188,7 +188,9 @@ int ReadTIFF(const uint8_t* const data, size_t data_size, fprintf(stderr, "Error! Cannot retrieve TIFF samples-per-pixel info.\n"); goto End; } - if (samples_per_px < 3 || samples_per_px > 4) goto End; // not supported + if (!(samples_per_px == 1 || samples_per_px == 3 || samples_per_px == 4)) { + goto End; // not supported + } if (!(TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &image_width) && TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &image_height))) {