[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:39:33 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=b268b86

The following commit has been merged in the master branch:
commit b268b86799848091d84d553b515a61e72be19f9c
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Tue Jun 10 03:22:59 2008 +0000

    Fixed several potential crashes.
---
 src/canonmn.cpp   |  6 ++++--
 src/convert.cpp   | 25 +++++++++++++++++++------
 src/nikonmn.cpp   |  5 ++++-
 src/olympusmn.cpp |  4 ++++
 src/tags.cpp      | 14 ++++++++++++--
 5 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/src/canonmn.cpp b/src/canonmn.cpp
index 327251b..02c00cd 100644
--- a/src/canonmn.cpp
+++ b/src/canonmn.cpp
@@ -984,8 +984,10 @@ namespace Exiv2 {
     std::ostream& CanonMakerNote::printCsLens(std::ostream& os,
                                                 const Value& value)
     {
-        if (value.typeId() != unsignedShort) return os << value;
-        if (value.count() < 3) return os << value;
+        if (   value.count() < 3
+            || value.typeId() != unsignedShort) {
+            return os << "(" << value << ")";
+        }
 
         float fu = value.toFloat(2);
         if (fu == 0.0) return os << value;
diff --git a/src/convert.cpp b/src/convert.cpp
index 2d7fb3f..a2a441e 100644
--- a/src/convert.cpp
+++ b/src/convert.cpp
@@ -548,15 +548,28 @@ namespace Exiv2 {
             }
         }
         else { // "Exif.GPSInfo.GPSTimeStamp"
-            double dhour = pos->value().toFloat(0);
-            double dmin = pos->value().toFloat(1);
-            // Hack: Need Value::toDouble
-            URational r = pos->value().toRational(2);
-            if (r.second == 0) {
+
+            bool ok = true;
+            if (pos->value().count() != 3) ok = false; 
+            if (ok) {
+                for (int i = 0; i < 3; ++i) {
+                    if (pos->value().toRational(i).second == 0) {
+                        ok = false;
+                        break;
+                    }
+                }
+            }
+            if (!ok) {
 #ifndef SUPPRESS_WARNINGS
                 std::cerr << "Warning: Failed to convert " << from << " to " << to << "
";
 #endif
+                return;
             }
+
+            double dhour = pos->value().toFloat(0);
+            double dmin = pos->value().toFloat(1);
+            // Hack: Need Value::toDouble
+            URational r = pos->value().toRational(2);
             double dsec = static_cast<double>(r.first)/r.second;
 
             if (!pos->value().ok()) {
@@ -702,7 +715,7 @@ namespace Exiv2 {
         for (int i = 0; i < 3; ++i) {
             const int32_t z = pos->value().toRational(i).first;
             const int32_t d = pos->value().toRational(i).second;
-            if (d == 0.0) {
+            if (d == 0) {
 #ifndef SUPPRESS_WARNINGS
                 std::cerr << "Warning: Failed to convert " << from << " to " << to << "
";
 #endif
diff --git a/src/nikonmn.cpp b/src/nikonmn.cpp
index eb52cdd..d64ce6f 100644
--- a/src/nikonmn.cpp
+++ b/src/nikonmn.cpp
@@ -1067,7 +1067,10 @@ namespace Exiv2 {
                                                const Value& value)
     {
         // Decoded by Robert Rottmerhusen <email at rottmerhusen.com>
-        if (value.size() != 4) return os << "(" << value << ")";
+        if (   value.size() != 4
+            || value.typeId() != undefined) {
+            return os << "(" << value << ")";
+        }
         float a = value.toFloat(0);
         long  b = value.toLong(1);
         long  c = value.toLong(2);
diff --git a/src/olympusmn.cpp b/src/olympusmn.cpp
index 9b15e46..cf9074c 100644
--- a/src/olympusmn.cpp
+++ b/src/olympusmn.cpp
@@ -506,6 +506,10 @@ namespace Exiv2 {
 
     std::ostream& OlympusMakerNote::print0x0204(std::ostream& os, const Value& value)
     {
+        if (   value.count() == 0
+            || value.toRational().second == 0) {
+            return os << "(" << value << ")";
+        }
         float f = value.toFloat();
         if (f == 0.0 || f == 1.0) return os << _("None");
         std::ostringstream oss;
diff --git a/src/tags.cpp b/src/tags.cpp
index 9555160..c04ecec 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -1225,7 +1225,7 @@ namespace Exiv2 {
     const TagInfo* ExifTags::tagList(IfdId ifdId)
     {
         const IfdInfo* ii = find(ifdInfo_, ifdId);
-        if (ii == 0) return 0;
+        if (ii == 0 || ii->tagList_ == 0) return 0;
         return ii->tagList_();
     } // ExifTags::tagList
 
@@ -1612,6 +1612,7 @@ namespace Exiv2 {
             for (int i = 0; i < n + 1; ++i) {
                 const int32_t z = value.toRational(i).first;
                 const int32_t d = value.toRational(i).second;
+                if (d == 0) return os << "(" << value << ")";
                 // Hack: Need Value::toDouble
                 double b = static_cast<double>(z)/d;
                 const int p = z % d == 0 ? 0 : prec[i];
@@ -1715,6 +1716,7 @@ namespace Exiv2 {
         std::ostringstream oss;
         oss.copyfmt(os);
         const int32_t d = value.toRational().second;
+        if (d == 0) return os << "(" << value << ")";
         const int p = d > 1 ? 1 : 0;
         os << std::fixed << std::setprecision(p) << value.toFloat() << " m";
         os.copyfmt(oss);
@@ -1725,6 +1727,11 @@ namespace Exiv2 {
     std::ostream& print0x0007(std::ostream& os, const Value& value)
     {
         if (value.count() == 3) {
+            for (int i = 0; i < 3; ++i) {
+                if (value.toRational(i).second == 0) {
+                    return os << "(" << value << ")";
+                }
+            }
             std::ostringstream oss;
             oss.copyfmt(os);
             const float sec = 3600 * value.toFloat(0)
@@ -1887,11 +1894,14 @@ namespace Exiv2 {
 
     std::ostream& print0x9202(std::ostream& os, const Value& value)
     {
+        if (   value.count() == 0
+            || value.toRational().second == 0) {
+            return os << "(" << value << ")";
+        }
         std::ostringstream oss;
         oss.copyfmt(os);
         os << "F" << std::setprecision(2) << fnumber(value.toFloat());
         os.copyfmt(oss);
-
         return os;
     }
 

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list