Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | From 275735d0354e39c0ac1dc3c0db2120d6f31d1990 Mon Sep 17 00:00:00 2001 |
| 2 | From: Even Rouault <even.rouault@spatialys.com> |
| 3 | Date: Mon, 27 Jun 2022 16:09:43 +0200 |
| 4 | Subject: [PATCH] _TIFFCheckFieldIsValidForCodec(): return FALSE when passed a |
| 5 | codec-specific tag and the codec is not configured (fixes #433) |
| 6 | |
| 7 | This avoids crashes when querying such tags |
| 8 | |
| 9 | CVE: CVE-2022-34526 |
| 10 | Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/275735d0354e39c0ac1dc3c0db2120d6f31d1990] |
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 12 | --- |
| 13 | libtiff/tif_dirinfo.c | 3 +++ |
| 14 | 1 file changed, 3 insertions(+) |
| 15 | |
| 16 | diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c |
| 17 | index 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 | -- |
| 31 | GitLab |
| 32 | |