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

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