libtiff: _TIFFCheckFieldIsValidForCodec(): return FALSE when passed a codec-specific tag and the codec is not configured (fixes #433) (32f82)

From 32f82588cda1d2f3f5f4678754490758bc61a790 Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Mon, 27 Jun 2022 16:09:43 +0200
Subject: [PATCH] _TIFFCheckFieldIsValidForCodec(): return FALSE when passed a
 codec-specific tag and the codec is not configured (fixes #433)

This avoids crashes when querying such tags
---
 libtiff/tif_dirinfo.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c
index 7fffa2a2..3eb22b8b 100644
--- a/libtiff/tif_dirinfo.c
+++ b/libtiff/tif_dirinfo.c
@@ -1175,6 +1175,9 @@ _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag)
 	    default:
 		return 1;
 	}
+	if( !TIFFIsCODECConfigured(tif->tif_dir.td_compression) ) {
+		return 0;
+	}
 	/* Check if codec specific tags are allowed for the current
 	 * compression scheme (codec) */
 	switch (tif->tif_dir.td_compression) {