From 61555de2407e34d0b1565cde502b625b37c426b0 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 26 Sep 2024 13:45:23 +0200 Subject: [PATCH] GTiff: do not query TIFFTAG_TRANSFERFUNCTION if m_nBitsPerSample > 24 Fixes #10875 --- frmts/gtiff/gtiffdataset_read.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frmts/gtiff/gtiffdataset_read.cpp b/frmts/gtiff/gtiffdataset_read.cpp index c8db2594b24d..8a676aa12bd2 100644 --- a/frmts/gtiff/gtiffdataset_read.cpp +++ b/frmts/gtiff/gtiffdataset_read.cpp @@ -4763,7 +4763,8 @@ void GTiffDataset::LoadICCProfile() { if (TIFFGetField(m_hTIFF, TIFFTAG_WHITEPOINT, &pWP)) { - if (!TIFFGetFieldDefaulted(m_hTIFF, TIFFTAG_TRANSFERFUNCTION, &pTFR, + if (m_nBitsPerSample > 24 || + !TIFFGetFieldDefaulted(m_hTIFF, TIFFTAG_TRANSFERFUNCTION, &pTFR, &pTFG, &pTFB) || pTFR == nullptr || pTFG == nullptr || pTFB == nullptr) {