Blame SOURCES/exiv2-CVE-2017-17723-1.patch

3f58c5
From c037d7377bc7bd63acc3f240101ff44002d19027 Mon Sep 17 00:00:00 2001
3f58c5
From: clanmills <robin@clanmills.com>
3f58c5
Date: Tue, 26 Sep 2017 21:37:53 +0100
3f58c5
Subject: =?UTF-8?q?Fix=20https://github.com/Exiv2/exiv2/issues/55=20=20Tha?=
3f58c5
 =?UTF-8?q?nk=20You,=20Rapha=C3=ABl=20Hertzog.?=
3f58c5
MIME-Version: 1.0
3f58c5
Content-Type: text/plain; charset=UTF-8
3f58c5
Content-Transfer-Encoding: 8bit
3f58c5
3f58c5
3f58c5
diff --git a/include/exiv2/value.hpp b/include/exiv2/value.hpp
3f58c5
index b61c0f44..2078c6bd 100644
3f58c5
--- a/include/exiv2/value.hpp
3f58c5
+++ b/include/exiv2/value.hpp
3f58c5
@@ -1663,7 +1663,7 @@ namespace Exiv2 {
3f58c5
     template<>
3f58c5
     inline long ValueType<Rational>::toLong(long n) const
3f58c5
     {
3f58c5
-        ok_ = (value_[n].second != 0);
3f58c5
+        ok_ = (value_[n].second != 0 && INT_MIN < value_[n].first && value_[n].first < INT_MAX );
3f58c5
         if (!ok_) return 0;
3f58c5
         return value_[n].first / value_[n].second;
3f58c5
     }
3f58c5
diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh
3f58c5
index f91c6759..c90ae559 100755
3f58c5
--- a/test/bugfixes-test.sh
3f58c5
+++ b/test/bugfixes-test.sh
3f58c5
@@ -602,6 +602,7 @@ source ./functions.source
3f58c5
     runTest exiv2 -pX                   $filename | xmllint --format -
3f58c5
 
3f58c5
     num=1231
3f58c5
+    printf "$num " >&3
3f58c5
     for X in a b; do
3f58c5
       filename=exiv2-bug$num$X.jpg
3f58c5
       echo '------>' Bug $filename '<-------' >&2
3f58c5
@@ -622,6 +623,7 @@ source ./functions.source
3f58c5
     runTest exiv2 -pa                   $filename
3f58c5
 
3f58c5
     num=1252
3f58c5
+    printf "$num " >&3
3f58c5
     for X in a b; do
3f58c5
       filename=exiv2-bug$num$X.exv
3f58c5
       echo '------>' Bug $filename '<-------' >&2
3f58c5
@@ -629,6 +631,13 @@ source ./functions.source
3f58c5
       runTest exiv2 -pa --grep lens/i   $filename
3f58c5
     done
3f58c5
 
3f58c5
+    num=g55
3f58c5
+    printf "$num " >&3
3f58c5
+    filename=POC8
3f58c5
+    echo '------>' Bug $filename '<-------' >&2
3f58c5
+    copyTestFile                      $filename
3f58c5
+    runTest exiv2                     $filename 2>/dev/null
3f58c5
+
3f58c5
 ) 3>&1 > $results 2>&1
3f58c5
 
3f58c5
 printf "\n"
3f58c5
diff --git a/test/data/bugfixes-test.out b/test/data/bugfixes-test.out
3f58c5
index d8754025..53d45dc5 100644
3f58c5
Binary files a/test/data/bugfixes-test.out and b/test/data/bugfixes-test.out differ