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

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