From d74f56e3b7ea55c8a18a03bc247cd5fd0ca288b2 Mon Sep 17 00:00:00 2001
From: Thomas Bernard <miniupnp@free.fr>
Date: Tue, 10 Nov 2020 02:05:05 +0100
Subject: [PATCH] Fix for building without JPEG support

Upstream-Status: Backport
https://gitlab.com/libtiff/libtiff/-/commit/d74f56e3b7ea55c8a18a03bc247cd5fd0ca288b2
https://gitlab.com/libtiff/libtiff/-/merge_requests/159/commits
CVE: CVE-2021-35524
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
---
 tools/tiff2pdf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
index dc69d2f9..d0b0ede7 100644
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -2087,10 +2087,13 @@ void t2p_read_tiff_size(T2P* t2p, TIFF* input){
 #endif
 		(void) 0;
 	}
+#ifdef JPEG_SUPPORT
 	if(t2p->pdf_compression == T2P_COMPRESS_JPEG
 	   && t2p->tiff_photometric == PHOTOMETRIC_YCBCR) {
 		k = checkMultiply64(TIFFNumberOfStrips(input), TIFFStripSize(input), t2p);
-	} else {
+	} else
+#endif
+	{
 		k = checkMultiply64(TIFFScanlineSize(input), t2p->tiff_length, t2p);
 		if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){
 			k = checkMultiply64(k, t2p->tiff_samplesperpixel, t2p);
-- 
GitLab

