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

1a1466
diff --git a/src/cr2image.cpp b/src/cr2image.cpp
1a1466
index 516e170..8a752b0 100644
1a1466
--- a/src/cr2image.cpp
1a1466
+++ b/src/cr2image.cpp
1a1466
@@ -107,8 +107,6 @@ namespace Exiv2 {
1a1466
             throw Error(3, "CR2");
1a1466
         }
1a1466
         clearMetadata();
1a1466
-        std::ofstream devnull;
1a1466
-        printStructure(devnull, kpsRecursive, 0);
1a1466
         ByteOrder bo = Cr2Parser::decode(exifData_,
1a1466
                                          iptcData_,
1a1466
                                          xmpData_,
1a1466
diff --git a/src/crwimage.cpp b/src/crwimage.cpp
1a1466
index 232919c..58240fd 100644
1a1466
--- a/src/crwimage.cpp
1a1466
+++ b/src/crwimage.cpp
1a1466
@@ -131,15 +131,8 @@ namespace Exiv2 {
1a1466
             throw Error(33);
1a1466
         }
1a1466
         clearMetadata();
1a1466
-        // read all metadata into memory
1a1466
-        // we should put this into clearMetadata(), however it breaks the test suite!
1a1466
-        try {
1a1466
-            std::ofstream devnull;
1a1466
-            printStructure(devnull,kpsRecursive,0);
1a1466
-        } catch (Exiv2::Error& /* e */) {
1a1466
-            DataBuf file(io().size());
1a1466
-            io_->read(file.pData_,file.size_);
1a1466
-        }
1a1466
+        DataBuf file( (long) io().size());
1a1466
+        io_->read(file.pData_,file.size_);
1a1466
 
1a1466
         CrwParser::decode(this, io_->mmap(), io_->size());
1a1466
 
1a1466
diff --git a/src/orfimage.cpp b/src/orfimage.cpp
1a1466
index 25651bd..9bd7a02 100644
1a1466
--- a/src/orfimage.cpp
1a1466
+++ b/src/orfimage.cpp
1a1466
@@ -119,8 +119,6 @@ namespace Exiv2 {
1a1466
             throw Error(3, "ORF");
1a1466
         }
1a1466
         clearMetadata();
1a1466
-        std::ofstream devnull;
1a1466
-        printStructure(devnull, kpsRecursive, 0);
1a1466
         ByteOrder bo = OrfParser::decode(exifData_,
1a1466
                                          iptcData_,
1a1466
                                          xmpData_,
1a1466
diff --git a/src/rw2image.cpp b/src/rw2image.cpp
1a1466
index 07de437..5922602 100644
1a1466
--- a/src/rw2image.cpp
1a1466
+++ b/src/rw2image.cpp
1a1466
@@ -130,8 +130,6 @@ namespace Exiv2 {
1a1466
             throw Error(3, "RW2");
1a1466
         }
1a1466
         clearMetadata();
1a1466
-        std::ofstream devnull;
1a1466
-        printStructure(devnull, kpsRecursive, 0);
1a1466
         ByteOrder bo = Rw2Parser::decode(exifData_,
1a1466
                                          iptcData_,
1a1466
                                          xmpData_,
1a1466
diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp
1a1466
index de66068..98da12b 100644
1a1466
--- a/src/tiffimage.cpp
1a1466
+++ b/src/tiffimage.cpp
1a1466
@@ -185,10 +185,6 @@ namespace Exiv2 {
1a1466
         }
1a1466
         clearMetadata();
1a1466
 
1a1466
-        // recursively print the structure to /dev/null to ensure all metadata is in memory
1a1466
-        // must be recursive to handle NEFs which stores the raw image in a subIFDs
1a1466
-        std::ofstream devnull;
1a1466
-        printStructure(devnull,kpsRecursive,0);
1a1466
         ByteOrder bo = TiffParser::decode(exifData_,
1a1466
                                           iptcData_,
1a1466
                                           xmpData_,
1a1466
@@ -200,7 +196,7 @@ namespace Exiv2 {
1a1466
         Exiv2::ExifKey            key("Exif.Image.InterColorProfile");
1a1466
         Exiv2::ExifData::iterator pos   = exifData_.findKey(key);
1a1466
         if ( pos != exifData_.end()  ) {
1a1466
-            iccProfile_.alloc(pos->count());
1a1466
+            iccProfile_.alloc(pos->count()*pos->typeSize());
1a1466
             pos->copy(iccProfile_.pData_,bo);
1a1466
         }
1a1466