From 9e8d09bffc418f05f757f770ff95b11fab66d972 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 30 Jun 2016 09:38:41 +0100 Subject: [PATCH] Improved error handling --- src/osgPlugins/tiff/ReaderWriterTIFF.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp index b51776012..0d6b31fc5 100644 --- a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp +++ b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp @@ -672,13 +672,18 @@ simage_tiff_load(std::istream& fin, case pack(PHOTOMETRIC_PALETTE, PLANARCONFIG_CONTIG): case pack(PHOTOMETRIC_PALETTE, PLANARCONFIG_SEPARATE): + if (TIFFGetField(in, TIFFTAG_COLORMAP, &red, &green, &blue) != 1) + { tifferror = ERR_READ; + break; + } + /* */ /* Convert 16-bit colormap to 8-bit (unless it looks */ /* like an old-style 8-bit colormap). */ /* */ - if (!tifferror && checkcmap(1<= 0; i--)