Skip to contentSkip to conversation

opencv: fix CVEs

PATCH New [email protected] 1 participant 1 message Aug 30, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opencv: fix CVEs

From: Kai Kang <[email protected]>

Fix CVEs for opencv 3.3:

* CVE-2017-12597
* CVE-2017-12598
* CVE-2017-12599
* CVE-2017-12600
* CVE-2017-12601
* CVE-2017-12602
* CVE-2017-12603
* CVE-2017-12604
* CVE-2017-12605
* CVE-2017-12606
* CVE-2017-12862
* CVE-2017-12863
* CVE-2017-12864

Refs:
1 https://github.com/opencv/opencv/pull/9376
2 https://security-tracker.debian.org/tracker/CVE-2017-12601

---
 ...round-GCC-7.1.1-compilation-issue-with-sa.patch | 127 ++++
 ...mgcodecs-refactoring-improve-code-quality.patch | 656 +++++++++++++++++++++
 ...3-imgproc-test-add-checks-for-remove-call.patch | 186 ++++++
 meta-oe/recipes-support/opencv/opencv_3.3.bb       |   3 +
 4 files changed, 972 insertions(+)
 create mode 100644 meta-oe/recipes-support/opencv/opencv/0001-build-workaround-GCC-7.1.1-compilation-issue-with-sa.patch
 create mode 100644 meta-oe/recipes-support/opencv/opencv/0002-imgcodecs-refactoring-improve-code-quality.patch
 create mode 100644 meta-oe/recipes-support/opencv/opencv/0003-imgproc-test-add-checks-for-remove-call.patch
meta-oe/recipes-support/opencv/opencv/0001-build-workaround-GCC-7.1.1-compilation-issue-with-sa.patch new file +127 -0
new file mode 100644
index 000000000..0140633db
@@ -0,0 +1,127 @@
+Upstream-Status: Backport [https://github.com/opencv/opencv/pull/9376/commits/0d854db361106dfcb055231fd0112c5b85ef2287]
+
+Fix CVEs for opencv 3.3.
+
+* CVE-2017-12597
+* CVE-2017-12598
+* CVE-2017-12599
+* CVE-2017-12600
+* CVE-2017-12601
+* CVE-2017-12602
+* CVE-2017-12603
+* CVE-2017-12604
+* CVE-2017-12605
+* CVE-2017-12606
+* CVE-2017-12862
+* CVE-2017-12863
+* CVE-2017-12864
+
+Signed-off-by: Kai Kang <[email protected]>
+---
+From 0d854db361106dfcb055231fd0112c5b85ef2287 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <[email protected]>
+Date: Tue, 15 Aug 2017 21:45:05 +0000
+Subject: [PATCH 1/3] build: workaround GCC 7.1.1 compilation issue with
+ sanitize flags
+
+Version: gcc (GCC) 7.1.1 20170622 (Red Hat 7.1.1-3)
+Flags: -fsanitize=address,undefined
+---
+ modules/ts/src/cuda_test.cpp | 56 ++++++++++++++++++++++++++------------------
+ 1 file changed, 33 insertions(+), 23 deletions(-)
+
+diff --git a/modules/ts/src/cuda_test.cpp b/modules/ts/src/cuda_test.cpp
+index a48e0a087..eb4cee136 100644
+--- a/modules/ts/src/cuda_test.cpp
++++ b/modules/ts/src/cuda_test.cpp
+@@ -322,16 +322,20 @@ namespace cvtest
+ 
+         if (m1.size() != m2.size())
+         {
+-            return AssertionFailure() << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different sizes : \""
+-                                      << expr1 << "\" [" << PrintToString(m1.size()) << "] vs \""
+-                                      << expr2 << "\" [" << PrintToString(m2.size()) << "]";
++            std::stringstream msg;
++            msg << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different sizes : \""
++                << expr1 << "\" [" << PrintToString(m1.size()) << "] vs \""
++                << expr2 << "\" [" << PrintToString(m2.size()) << "]";
++            return AssertionFailure() << msg.str();
+         }
+ 
+         if (m1.type() != m2.type())
+         {
+-            return AssertionFailure() << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different types : \""
+-                                      << expr1 << "\" [" << PrintToString(MatType(m1.type())) << "] vs \""
+-                                      << expr2 << "\" [" << PrintToString(MatType(m2.type())) << "]";
++            std::stringstream msg;
++            msg << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different types : \""
++                << expr1 << "\" [" << PrintToString(MatType(m1.type())) << "] vs \""
++                << expr2 << "\" [" << PrintToString(MatType(m2.type())) << "]";
++             return AssertionFailure() << msg.str();
+         }
+ 
+         Mat diff;
+@@ -343,12 +347,14 @@ namespace cvtest
+ 
+         if (maxVal > eps)
+         {
+-            return AssertionFailure() << "The max difference between matrices \"" << expr1 << "\" and \"" << expr2
+-                                      << "\" is " << maxVal << " at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ")"
+-                                      << ", which exceeds \"" << eps_expr << "\", where \""
+-                                      << expr1 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m1, maxLoc) << ", \""
+-                                      << expr2 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m2, maxLoc) << ", \""
+-                                      << eps_expr << "\" evaluates to " << eps;
++            std::stringstream msg;
++            msg << "The max difference between matrices \"" << expr1 << "\" and \"" << expr2
++                << "\" is " << maxVal << " at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ")"
++                << ", which exceeds \"" << eps_expr << "\", where \""
++                << expr1 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m1, maxLoc) << ", \""
++                << expr2 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m2, maxLoc) << ", \""
++                << eps_expr << "\" evaluates to " << eps;
++            return AssertionFailure() << msg.str();
+         }
+ 
+         return AssertionSuccess();
+@@ -469,9 +475,11 @@ namespace cvtest
+     {
+         if (gold.size() != actual.size())
+         {
+-            return testing::AssertionFailure() << "KeyPoints size mistmach\n"
+-                                               << "\"" << gold_expr << "\" : " << gold.size() << "\n"
+-                                               << "\"" << actual_expr << "\" : " << actual.size();
++            std::stringstream msg;
++            msg << "KeyPoints size mistmach\n"
++                << "\"" << gold_expr << "\" : " << gold.size() << "\n"
++                << "\"" << actual_expr << "\" : " << actual.size();
++            return AssertionFailure() << msg.str();
+         }
+ 
+         std::sort(actual.begin(), actual.end(), KeyPointLess());
+@@ -484,14 +492,16 @@ namespace cvtest
+ 
+             if (!keyPointsEquals(p1, p2))
+             {
+-                return testing::AssertionFailure() << "KeyPoints differ at " << i << "\n"
+-                                                   << "\"" << gold_expr << "\" vs \"" << actual_expr << "\" : \n"
+-                                                   << "pt : " << testing::PrintToString(p1.pt) << " vs " << testing::PrintToString(p2.pt) << "\n"
+-                                                   << "size : " << p1.size << " vs " << p2.size << "\n"
+-                                                   << "angle : " << p1.angle << " vs " << p2.angle << "\n"
+-                                                   << "response : " << p1.response << " vs " << p2.response << "\n"
+-                                                   << "octave : " << p1.octave << " vs " << p2.octave << "\n"
+-                                                   << "class_id : " << p1.class_id << " vs " << p2.class_id;
++                std::stringstream msg;
++                msg << "KeyPoints differ at " << i << "\n"
++                    << "\"" << gold_expr << "\" vs \"" << actual_expr << "\" : \n"
++                    << "pt : " << testing::PrintToString(p1.pt) << " vs " << testing::PrintToString(p2.pt) << "\n"
++                    << "size : " << p1.size << " vs " << p2.size << "\n"
++                    << "angle : " << p1.angle << " vs " << p2.angle << "\n"
++                    << "response : " << p1.response << " vs " << p2.response << "\n"
++                    << "octave : " << p1.octave << " vs " << p2.octave << "\n"
++                    << "class_id : " << p1.class_id << " vs " << p2.class_id;
++                return AssertionFailure() << msg.str();
+             }
+         }
+ 
+-- 
+2.14.1
+
meta-oe/recipes-support/opencv/opencv/0002-imgcodecs-refactoring-improve-code-quality.patch new file +656 -0

656 lines not on this page · raw message

meta-oe/recipes-support/opencv/opencv/0003-imgproc-test-add-checks-for-remove-call.patch new file +186 -0

186 lines not on this page · raw message

meta-oe/recipes-support/opencv/opencv_3.3.bb +3 -0
index a6a130271..efbb2f52a 100644
@@ -46,6 +46,9 @@ SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \
     file://uselocalxfeatures.patch;patchdir=../contrib/ \
     file://0002-Make-opencv-ts-create-share-library-intead-of-static.patch \
     file://0003-To-fix-errors-as-following.patch \
+    file://0001-build-workaround-GCC-7.1.1-compilation-issue-with-sa.patch \
+    file://0002-imgcodecs-refactoring-improve-code-quality.patch \
+    file://0003-imgproc-test-add-checks-for-remove-call.patch \
 "
 
 PV = "3.3+git${SRCPV}"
Signature · 1 line
2.14.1