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

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