From ba6d7782ee2a68b0dbefbccfc1c7fab59d9e9b69 Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 20 Jun 2015 10:14:02 +0000 Subject: [PATCH] Fixed crash when reading a corrupt tiff file, the tiff should be closed before the memory is freed. --- coders/tiff.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/coders/tiff.c b/coders/tiff.c index c0ce9c663..936c82b6d 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -687,7 +687,7 @@ static void TIFFGetEXIFProperties(TIFF *tiff,Image *image, directory=TIFFCurrentDirectory(tiff); if (TIFFReadEXIFDirectory(tiff,offset) != 1) { - directory=TIFFCurrentDirectory(tiff); + TIFFSetDirectory(tiff,directory); return; } sans=NULL; @@ -1195,15 +1195,15 @@ RestoreMSCWarning break; } case PHOTOMETRIC_LOGL: - { + { (void) SetImageProperty(image,"tiff:photometric","CIE Log2(L)",exception); break; - } + } case PHOTOMETRIC_LOGLUV: - { + { (void) SetImageProperty(image,"tiff:photometric","LOGLUV",exception); break; - } + } #if defined(PHOTOMETRIC_MASK) case PHOTOMETRIC_MASK: { @@ -1391,8 +1391,8 @@ RestoreMSCWarning status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); if (status == MagickFalse) { - quantum_info=DestroyQuantumInfo(quantum_info); TIFFClose(tiff); + quantum_info=DestroyQuantumInfo(quantum_info); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } status=MagickTrue; -- 2.40.0