Blame SOURCES/exiv2-CVE-2018-10998.patch

240d3a
diff --git a/src/exiv2.cpp b/src/exiv2.cpp
240d3a
index d6a45e1..dbd2834 100644
240d3a
--- a/src/exiv2.cpp
240d3a
+++ b/src/exiv2.cpp
240d3a
@@ -150,31 +150,35 @@ int main(int argc, char* const argv[])
240d3a
         return 0;
240d3a
     }
240d3a
240d3a
-    // Create the required action class
240d3a
-    Action::TaskFactory& taskFactory = Action::TaskFactory::instance();
240d3a
-    Action::Task::AutoPtr task
240d3a
-        = taskFactory.create(Action::TaskType(params.action_));
240d3a
-    assert(task.get());
240d3a
-
240d3a
-    // Process all files
240d3a
     int rc = 0;
240d3a
-    int n = 1;
240d3a
-    int s = static_cast<int>(params.files_.size());
240d3a
-    int w = s > 9 ? s > 99 ? 3 : 2 : 1;
240d3a
-    for (Params::Files::const_iterator i = params.files_.begin();
240d3a
-         i != params.files_.end(); ++i) {
240d3a
-        if (params.verbose_) {
240d3a
-            std::cout << _("File") << " " << std::setw(w) << std::right << n++ << "/" << s << ": "
240d3a
-                      << *i << std::endl;
240d3a
+    try {
240d3a
+        // Create the required action class
240d3a
+        Action::TaskFactory& taskFactory = Action::TaskFactory::instance();
240d3a
+        Action::Task::AutoPtr task = taskFactory.create(Action::TaskType(params.action_));
240d3a
+        assert(task.get());
240d3a
+
240d3a
+        // Process all files
240d3a
+        int n = 1;
240d3a
+        int s = static_cast<int>(params.files_.size());
240d3a
+        int w = s > 9 ? s > 99 ? 3 : 2 : 1;
240d3a
+        for (Params::Files::const_iterator i = params.files_.begin(); i != params.files_.end(); ++i) {
240d3a
+            if (params.verbose_) {
240d3a
+                std::cout << _("File") << " " << std::setw(w) << std::right << n++ << "/" << s << ": " << *i
240d3a
+                          << std::endl;
240d3a
+            }
240d3a
+            int ret = task->run(*i);
240d3a
+            if (rc == 0)
240d3a
+                rc = ret;
240d3a
         }
240d3a
-        int ret = task->run(*i);
240d3a
-        if (rc == 0) rc = ret;
240d3a
-    }
240d3a
240d3a
-    taskFactory.cleanup();
240d3a
-    params.cleanup();
240d3a
-    Exiv2::XmpParser::terminate();
240d3a
+        taskFactory.cleanup();
240d3a
+        params.cleanup();
240d3a
+        Exiv2::XmpParser::terminate();
240d3a
240d3a
+    } catch (const std::exception& exc) {
240d3a
+        std::cerr << "Uncaught exception: " << exc.what() << std::endl;
240d3a
+        rc = 1;
240d3a
+    }
240d3a
     // Return a positive one byte code for better consistency across platforms
240d3a
     return static_cast<unsigned int>(rc) % 256;
240d3a
 } // main