From 4176ab21061f425b4ee274f7f9c6634dacf5ca7c Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sat, 24 Sep 2022 14:36:02 +0200 Subject: [PATCH] tiff2vips: avoid `g_assert_not_reached` in the default clause (#3064) Since that could terminate the application in debug builds. Also, add the missing case clause for `PHOTOMETRIC_MINISWHITE`. Resolves: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51013. --- libvips/foreign/tiff2vips.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 744a7220..0f0d6b58 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -1937,13 +1937,15 @@ rtiff_decompress_jpeg_run( Rtiff *rtiff, j_decompress_ptr cinfo, bytes_per_pixel = 3; break; + case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: cinfo->jpeg_color_space = JCS_GRAYSCALE; bytes_per_pixel = 1; break; default: - g_assert_not_reached(); + cinfo->jpeg_color_space = JCS_UNKNOWN; + bytes_per_pixel = 1; break; }