File 0001-Fix-SEGV-in-DataValue-Copy.patch of Package exiv2.9131

From 43c3eb52b99b7cc48c59a5caa56368fb1b1b1885 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= <piponazo@gmail.com>
Date: Sat, 13 Oct 2018 10:04:30 +0200
Subject: [PATCH] Fix #457

(cherry picked from commit 670fb73dd5ee8acab90971c4878de29f9fc43a02)
---
 src/tiffimage.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp
index 415c018f..fd5a4769 100644
--- a/src/tiffimage.cpp
+++ b/src/tiffimage.cpp
@@ -199,12 +199,16 @@ namespace Exiv2 {
         // read profile from the metadata
         Exiv2::ExifKey            key("Exif.Image.InterColorProfile");
         Exiv2::ExifData::iterator pos   = exifData_.findKey(key);
-        if ( pos != exifData_.end()  ) {
-            iccProfile_.alloc(pos->count()*pos->typeSize());
+        if ( pos != exifData_.end() ) {
+            long size = pos->count() * pos->typeSize();
+            if (size == 0) {
+                throw Error(kerFailedToReadImageData);
+            }
+            iccProfile_.alloc(size);
             pos->copy(iccProfile_.pData_,bo);
         }
 
-    } // TiffImage::readMetadata
+    }
 
     void TiffImage::writeMetadata()
     {
-- 
2.25.1

openSUSE Build Service is sponsored by