blob: 54c334574686006c182b4635335ea96d213714f1 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From 275735d0354e39c0ac1dc3c0db2120d6f31d1990 Mon Sep 17 00:00:00 2001
2From: Even Rouault <even.rouault@spatialys.com>
3Date: Mon, 27 Jun 2022 16:09:43 +0200
4Subject: [PATCH] _TIFFCheckFieldIsValidForCodec(): return FALSE when passed a
5 codec-specific tag and the codec is not configured (fixes #433)
6
7This avoids crashes when querying such tags
8
9CVE: CVE-2022-34526
10Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/275735d0354e39c0ac1dc3c0db2120d6f31d1990]
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 libtiff/tif_dirinfo.c | 3 +++
14 1 file changed, 3 insertions(+)
15
16diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c
17index c30f569b..3371cb5c 100644
18--- a/libtiff/tif_dirinfo.c
19+++ b/libtiff/tif_dirinfo.c
20@@ -1191,6 +1191,9 @@ _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag)
21 default:
22 return 1;
23 }
24+ if( !TIFFIsCODECConfigured(tif->tif_dir.td_compression) ) {
25+ return 0;
26+ }
27 /* Check if codec specific tags are allowed for the current
28 * compression scheme (codec) */
29 switch (tif->tif_dir.td_compression) {
30--
31GitLab
32