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

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