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

3f58c5
diff --git a/src/canonmn.cpp b/src/canonmn.cpp
3f58c5
index 450c7d9..f768c05 100644
3f58c5
--- a/src/canonmn.cpp
3f58c5
+++ b/src/canonmn.cpp
3f58c5
@@ -1774,9 +1774,13 @@ namespace Exiv2 {
3f58c5
     {
3f58c5
         try {
3f58c5
             // 1140
3f58c5
-            if( metadata->findKey(ExifKey("Exif.Image.Model"        ))->value().toString() == "Canon EOS 30D"
3f58c5
-            &&  metadata->findKey(ExifKey("Exif.CanonCs.Lens"       ))->value().toString() == "24 24 1"
3f58c5
-            &&  metadata->findKey(ExifKey("Exif.CanonCs.MaxAperture"))->value().toString() == "95" // F2.8
3f58c5
+            const ExifData::const_iterator itModel = metadata->findKey(ExifKey("Exif.Image.Model"));
3f58c5
+            const ExifData::const_iterator itLens  = metadata->findKey(ExifKey("Exif.CanonCs.Lens"));
3f58c5
+            const ExifData::const_iterator itApert = metadata->findKey(ExifKey("Exif.CanonCs.MaxAperture"));
3f58c5
+
3f58c5
+            if( itModel != metadata->end() && itModel->value().toString() == "Canon EOS 30D"
3f58c5
+            &&  itLens  != metadata->end() && itLens->value().toString() == "24 24 1"
3f58c5
+            &&  itApert != metadata->end() && itApert->value().toString() == "95" // F2.8
3f58c5
             ){
3f58c5
                 return os << "Canon EF-S 24mm f/2.8 STM" ;
3f58c5
             }