From 7abe129ac48ed85fd8e2b849076f06a66a50fc05 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 7 Aug 2019 17:08:18 +0100 Subject: [PATCH] don't invert signed ints in tiffload --- ...e-minimized-thumbnail_fuzzer-5718717719117824 | Bin 0 -> 1050 bytes libvips/foreign/tiff2vips.c | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 fuzz/thumbnail_fuzzer_corpus/clusterfuzz-testcase-minimized-thumbnail_fuzzer-5718717719117824 diff --git a/fuzz/thumbnail_fuzzer_corpus/clusterfuzz-testcase-minimized-thumbnail_fuzzer-5718717719117824 b/fuzz/thumbnail_fuzzer_corpus/clusterfuzz-testcase-minimized-thumbnail_fuzzer-5718717719117824 new file mode 100644 index 0000000000000000000000000000000000000000..5f4ecac4d4644f5c25ba389aea38efb3b807b265 GIT binary patch literal 1050 zcmebD)M8k`z`&qDckur|UMv5Dfr1y+T*ko2%)kirX&}%5pIQIoZ)iV*P Jo;XtxssNSbiP!)D literal 0 HcmV?d00001 diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 03a4e31b..8d909722 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -938,7 +938,12 @@ rtiff_greyscale_line( Rtiff *rtiff, int photometric_interpretation = rtiff->header.photometric_interpretation; VipsBandFormat format = rtiff_guess_format( rtiff ); - gboolean invert = photometric_interpretation == PHOTOMETRIC_MINISWHITE; + + /* Swapping black and white doesn't work for the signed formats. + */ + gboolean invert = + photometric_interpretation == PHOTOMETRIC_MINISWHITE && + vips_band_format_isuint( format ); int x, i;