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

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