libtiff/backport-CVE-2023-6228.patch
liningjie 930d926f26 fix CVE-2023-6228
(cherry picked from commit 680716ea2c39399e269e593191434a74fde9bfe2)
2023-11-22 16:10:32 +08:00

28 lines
888 B
Diff

From a239f91e7146d35082ffb594c1d6a279020cc8b4 Mon Sep 17 00:00:00 2001
From: Su_Laus <sulau@freenet.de>
Date: Tue, 21 Nov 2023 16:58:05 +0800
Subject: [PATCH] Check also if codec of input image is available,
independently from codec check of output image and return with error if not.
Fixes #606.
---
tools/tiffcp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
index 7120837..5b2e879 100644
--- a/tools/tiffcp.c
+++ b/tools/tiffcp.c
@@ -724,6 +724,8 @@ tiffcp(TIFF* in, TIFF* out)
else
CopyField(TIFFTAG_COMPRESSION, compression);
TIFFGetFieldDefaulted(in, TIFFTAG_COMPRESSION, &input_compression);
+ if (!TIFFIsCODECConfigured(input_compression))
+ return FALSE;
TIFFGetFieldDefaulted(in, TIFFTAG_PHOTOMETRIC, &input_photometric);
if (input_compression == COMPRESSION_JPEG) {
/* Force conversion to RGB */
--
2.27.0