Blame SOURCES/exiv2-CVE-2017-11683.patch

240d3a
From 1f1715c086d8dcdf5165b19164af9aee7aa12e98 Mon Sep 17 00:00:00 2001
240d3a
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dan.cermak@cgc-instruments.com>
240d3a
Date: Fri, 6 Oct 2017 00:37:43 +0200
240d3a
Subject: =?UTF-8?q?Use=20nullptr=20check=20instead=20of=20assertion,=20by?=
240d3a
 =?UTF-8?q?=20Rapha=C3=ABl=20Hertzog?=
240d3a
MIME-Version: 1.0
240d3a
Content-Type: text/plain; charset=UTF-8
240d3a
Content-Transfer-Encoding: 8bit
240d3a
240d3a
Source:
240d3a
https://github.com/Exiv2/exiv2/issues/57#issuecomment-333086302
240d3a
240d3a
tc can be a null pointer when the TIFF tag is unknown (the factory
240d3a
then returns an auto_ptr(0)) => as this can happen for corrupted
240d3a
files, an explicit check should be used because an assertion can be
240d3a
turned of in release mode (with NDEBUG defined)
240d3a
240d3a
This also fixes #57
240d3a
240d3a
diff --git a/src/tiffvisitor.cpp b/src/tiffvisitor.cpp
240d3a
index 74f8d078..4ab733d4 100644
240d3a
--- a/src/tiffvisitor.cpp
240d3a
+++ b/src/tiffvisitor.cpp
240d3a
@@ -1294,11 +1294,12 @@ namespace Exiv2 {
240d3a
             }
240d3a
             uint16_t tag = getUShort(p, byteOrder());
240d3a
             TiffComponent::AutoPtr tc = TiffCreator::create(tag, object->group());
240d3a
-            // The assertion typically fails if a component is not configured in
240d3a
-            // the TIFF structure table
240d3a
-            assert(tc.get());
240d3a
-            tc->setStart(p);
240d3a
-            object->addChild(tc);
240d3a
+            if (tc.get()) {
240d3a
+                tc->setStart(p);
240d3a
+                object->addChild(tc);
240d3a
+            } else {
240d3a
+               EXV_WARNING << "Unable to handle tag " << tag << ".\n";
240d3a
+            }
240d3a
             p += 12;
240d3a
         }
240d3a