Skip to content

Commit

Permalink
opencv: refresh patches with devtool to apply cleanly
Browse files Browse the repository at this point in the history
* fixes:
WARNING: opencv-4.1.0-r0 do_patch: Fuzz detected:

Applying patch CVE-2019-14491.patch
patching file modules/objdetect/src/cascadedetect.cpp
Hunk #1 succeeded at 46 with fuzz 1 (offset -1 lines).
Hunk #2 succeeded at 540 (offset -1 lines).
Hunk #3 succeeded at 552 (offset -1 lines).
Hunk #4 succeeded at 613 (offset -1 lines).
Hunk #5 succeeded at 774 (offset -1 lines).
Hunk #6 succeeded at 825 (offset -1 lines).
Hunk #7 succeeded at 1470 (offset -36 lines).
patching file modules/objdetect/src/cascadedetect.hpp

The context lines in the patches can be updated with devtool:

    devtool modify opencv
    devtool finish --force-patch-refresh opencv <layer_path>

Don't forget to review changes done by devtool!

WARNING: opencv-4.1.0-r0 do_patch: QA Issue: Patch log indicates that patches do not apply cleanly. [patch-fuzz]

Signed-off-by: Martin Jansa <[email protected]>
Signed-off-by: Armin Kuster <[email protected]>
  • Loading branch information
shr-project authored and akuster committed Apr 7, 2021
1 parent 7796f4c commit 637967e
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 118 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 85b882b4ceb57fe6538f47af58d0a970923fde0e Mon Sep 17 00:00:00 2001
From 806de12b95a69572fffea8eb49b4ec3fb722b65f Mon Sep 17 00:00:00 2001
From: Ricardo Ribalda Delgado <[email protected]>
Date: Thu, 31 Mar 2016 00:20:15 +0200
Subject: [PATCH] 3rdparty/ippicv: Use pre-downloaded ipp
Expand All @@ -11,7 +11,7 @@ Signed-off-by: Ismo Puustinen <[email protected]>
1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/3rdparty/ippicv/ippicv.cmake b/3rdparty/ippicv/ippicv.cmake
index ae8748c..305abdb 100644
index ae8748c283..305abdb58d 100644
--- a/3rdparty/ippicv/ippicv.cmake
+++ b/3rdparty/ippicv/ippicv.cmake
@@ -39,18 +39,5 @@ function(download_ippicv root_var)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 9659f5a1e75fc29c9879c301767bba72ecf9042a Mon Sep 17 00:00:00 2001
From b34a6e8d4582aa13ad4cd58547d8e0f0a0f1c6a6 Mon Sep 17 00:00:00 2001
From: Khem Raj <[email protected]>
Date: Tue, 11 Sep 2018 00:21:18 -0700
Subject: [PATCH] Dont use isystem
Expand All @@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <[email protected]>
1 file changed, 2 insertions(+)

diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
index 59bc826..055dfce 100644
index 59bc826ed0..055dfce251 100644
--- a/cmake/OpenCVPCHSupport.cmake
+++ b/cmake/OpenCVPCHSupport.cmake
@@ -18,6 +18,8 @@ IF(CV_GCC)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From fe27d0e2341683606704115949d16250e4cacbfa Mon Sep 17 00:00:00 2001
From 23425e45f6e26f2b1e387b88e104872b3a1ea5d1 Mon Sep 17 00:00:00 2001
From: Jason Wessel <[email protected]>
Date: Wed, 9 May 2018 13:33:59 -0700
Subject: [PATCH] Temporarliy work around deprecated ffmpeg RAW function
Expand All @@ -11,7 +11,7 @@ Signed-off-by: Jason Wessel <[email protected]>
1 file changed, 8 insertions(+)

diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp
index 0d360ad..566df66 100644
index 0d360ad5d9..566df6664b 100644
--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
+++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
@@ -736,6 +736,14 @@ struct ImplMutex::Impl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
From 1edc925ecd7fb54d2dc78452069084475fbe2a70 Mon Sep 17 00:00:00 2001
From d9bdafa95f329f33d829d89a2e51adaf833768cc Mon Sep 17 00:00:00 2001
From: Khem Raj <[email protected]>
Date: Thu, 16 Jan 2020 08:52:00 -0800
Subject: [PATCH] carotene: Replace ipcp-unit-growth with ipa-cp-unit-growth on gcc >= 10
Subject: [PATCH] carotene: Replace ipcp-unit-growth with ipa-cp-unit-growth on
gcc >= 10

gcc 10+ has renamed this option, therefore check for gcc version before
deciding which name to use for opt parameter

Upstream-Status: Submitted [https://github.com/opencv/opencv/pull/16369]
Signed-off-by: Khem Raj <[email protected]>

---
3rdparty/carotene/CMakeLists.txt | 8 ++++++--
3rdparty/carotene/hal/CMakeLists.txt | 7 ++++++-
Expand Down Expand Up @@ -50,6 +52,3 @@ index c4b9acaedd..bbc5b11a80 100644
# set_source_files_properties(impl.cpp $<TARGET_OBJECTS:carotene_objs> COMPILE_FLAGS "--param ipcp-unit-growth=100000 --param inline-unit-growth=100000 --param large-stack-frame-growth=5000")
endif()

--
2.25.0

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 46ffa1f8f443b71673774fcb864eb741bbc26200 Mon Sep 17 00:00:00 2001
From 6a490df70aadc43ed4f503452c278e334716826d Mon Sep 17 00:00:00 2001
From: Bian Naimeng <[email protected]>
Date: Wed, 19 Apr 2017 03:11:37 +0900
Subject: [PATCH] Make opencv-ts create share library intead of static.
Expand All @@ -10,7 +10,7 @@ Signed-off-by: Lei Maohui <[email protected]>
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/ts/CMakeLists.txt b/modules/ts/CMakeLists.txt
index f95bed0..ee67858 100644
index f95bed0793..ee67858df8 100644
--- a/modules/ts/CMakeLists.txt
+++ b/modules/ts/CMakeLists.txt
@@ -4,7 +4,7 @@ if(NOT BUILD_opencv_ts AND NOT BUILD_TESTS AND NOT BUILD_PERF_TESTS)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 867caccc358266f7021f076fc8c8e41bf048782c Mon Sep 17 00:00:00 2001
From b3dc5478cb0d2d2b617dc6c5e28d59559edadf36 Mon Sep 17 00:00:00 2001
From: Huang Qiyu <[email protected]>
Date: Fri, 19 May 2017 04:27:50 +0900
Subject: [PATCH] To fix errors as following:
Expand All @@ -21,7 +21,7 @@ Signed-off-by: Ismo Puustinen <[email protected]>
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/ts/include/opencv2/ts.hpp b/modules/ts/include/opencv2/ts.hpp
index b9d6b74..f1ee7ee 100644
index b9d6b74ffc..f1ee7ee429 100644
--- a/modules/ts/include/opencv2/ts.hpp
+++ b/modules/ts/include/opencv2/ts.hpp
@@ -622,7 +622,7 @@ protected:
Expand All @@ -43,7 +43,7 @@ index b9d6b74..f1ee7ee 100644
#define CV_TEST_INIT0_NOOP (void)0

diff --git a/modules/ts/include/opencv2/ts/ocl_test.hpp b/modules/ts/include/opencv2/ts/ocl_test.hpp
index 11572e9..438112e 100644
index 11572e9f48..438112e2aa 100644
--- a/modules/ts/include/opencv2/ts/ocl_test.hpp
+++ b/modules/ts/include/opencv2/ts/ocl_test.hpp
@@ -82,7 +82,7 @@ inline UMat ToUMat(InputArray src)
Expand All @@ -56,7 +56,7 @@ index 11572e9..438112e 100644
#define MAX_VALUE 357

diff --git a/modules/ts/include/opencv2/ts/ts_ext.hpp b/modules/ts/include/opencv2/ts/ts_ext.hpp
index b5cea3e..e5b0b4b 100644
index b5cea3e46d..e5b0b4ba8c 100644
--- a/modules/ts/include/opencv2/ts/ts_ext.hpp
+++ b/modules/ts/include/opencv2/ts/ts_ext.hpp
@@ -9,7 +9,7 @@
Expand Down
56 changes: 28 additions & 28 deletions meta-oe/recipes-support/opencv/opencv/CVE-2019-14491.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 321c74ccd6077bdea1d47450ca4fe955cb5b6330 Mon Sep 17 00:00:00 2001
From 5a9628c134a7314e10ea0bcc4e789c935251a7f5 Mon Sep 17 00:00:00 2001
From: Alexander Alekhin <[email protected]>
Date: Thu, 25 Jul 2019 17:15:59 +0300
Subject: [PATCH] objdetect: validate feature rectangle on reading
Expand All @@ -9,39 +9,40 @@ Upstream-Status: Backport [https://github.com/opencv/opencv/commit/ac425f67e4c1d
Comment: No changes in any hunk

Signed-off-by: Neetika Singh <[email protected]>

---
modules/objdetect/src/cascadedetect.cpp | 43 +++++++++++++++++++++----
modules/objdetect/src/cascadedetect.hpp | 6 ++--
2 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/modules/objdetect/src/cascadedetect.cpp b/modules/objdetect/src/cascadedetect.cpp
index 4b2078306fe..bd62cd21a1b 100644
index a1865e9062..b7ef04ea7b 100644
--- a/modules/objdetect/src/cascadedetect.cpp
+++ b/modules/objdetect/src/cascadedetect.cpp
@@ -47,6 +47,10 @@
#include "opencv2/objdetect/objdetect_c.h"
@@ -46,6 +46,10 @@
#include "cascadedetect.hpp"
#include "opencl_kernels_objdetect.hpp"

+#if defined(_MSC_VER)
+# pragma warning(disable:4458) // declaration of 'origWinSize' hides class member
+#endif
+
namespace cv
{

@@ -537,7 +541,7 @@ bool FeatureEvaluator::setImage( InputArray _image, const std::vector<float>& _s

@@ -536,7 +540,7 @@ bool FeatureEvaluator::setImage( InputArray _image, const std::vector<float>& _s
//---------------------------------------------- HaarEvaluator ---------------------------------------

-bool HaarEvaluator::Feature :: read( const FileNode& node )
+bool HaarEvaluator::Feature::read(const FileNode& node, const Size& origWinSize)
{
FileNode rnode = node[CC_RECTS];
FileNodeIterator it = rnode.begin(), it_end = rnode.end();
@@ -549,11 +553,23 @@ bool HaarEvaluator::Feature :: read( const FileNode& node )
@@ -548,11 +552,23 @@ bool HaarEvaluator::Feature :: read( const FileNode& node )
rect[ri].weight = 0.f;
}

+ const int W = origWinSize.width;
+ const int H = origWinSize.height;
+
Expand All @@ -62,20 +63,20 @@ index 4b2078306fe..bd62cd21a1b 100644
+ CV_CheckLE(rw.r.y + rw.r.height, H, "Invalid HAAR feature");
+ }
}

tilted = (int)node[CC_TILTED] != 0;
@@ -598,7 +614,7 @@ bool HaarEvaluator::read(const FileNode& node, Size _origWinSize)

@@ -597,7 +613,7 @@ bool HaarEvaluator::read(const FileNode& node, Size _origWinSize)
for(i = 0; i < n; i++, ++it)
{
- if(!ff[i].read(*it))
+ if(!ff[i].read(*it, _origWinSize))
return false;
if( ff[i].tilted )
hasTiltedFeatures = true;
@@ -759,11 +775,24 @@ int HaarEvaluator::getSquaresOffset() const
@@ -758,11 +774,24 @@ int HaarEvaluator::getSquaresOffset() const
}

//---------------------------------------------- LBPEvaluator -------------------------------------
-bool LBPEvaluator::Feature :: read(const FileNode& node )
+bool LBPEvaluator::Feature::read(const FileNode& node, const Size& origWinSize)
Expand All @@ -98,8 +99,8 @@ index 4b2078306fe..bd62cd21a1b 100644
+
return true;
}

@@ -797,7 +826,7 @@ bool LBPEvaluator::read( const FileNode& node, Size _origWinSize )
@@ -796,7 +825,7 @@ bool LBPEvaluator::read( const FileNode& node, Size _origWinSize )
std::vector<Feature>& ff = *features;
for(int i = 0; it != it_end; ++it, i++)
{
Expand All @@ -108,41 +109,40 @@ index 4b2078306fe..bd62cd21a1b 100644
return false;
}
nchannels = 1;
@@ -1477,6 +1506,8 @@ bool CascadeClassifierImpl::Data::read(const FileNode &root)
@@ -1441,6 +1470,8 @@ bool CascadeClassifierImpl::Data::read(const FileNode &root)
origWinSize.width = (int)root[CC_WIDTH];
origWinSize.height = (int)root[CC_HEIGHT];
CV_Assert( origWinSize.height > 0 && origWinSize.width > 0 );
+ CV_CheckLE(origWinSize.width, 1000000, "Invalid window size (too large)");
+ CV_CheckLE(origWinSize.height, 1000000, "Invalid window size (too large)");

// load feature params
FileNode fn = root[CC_FEATURE_PARAMS];
diff --git a/modules/objdetect/src/cascadedetect.hpp b/modules/objdetect/src/cascadedetect.hpp
index f9910530b94..d9a288fcdda 100644
index a011ed4804..ffc03af841 100644
--- a/modules/objdetect/src/cascadedetect.hpp
+++ b/modules/objdetect/src/cascadedetect.hpp
@@ -317,12 +317,12 @@ class HaarEvaluator CV_FINAL : public FeatureEvaluator
@@ -317,12 +317,12 @@ public:
struct Feature
{
Feature();
- bool read( const FileNode& node );
+ bool read(const FileNode& node, const Size& origWinSize);

bool tilted;

enum { RECT_NUM = 3 };
- struct
+ struct RectWeigth
{
Rect r;
float weight;
@@ -412,7 +412,7 @@ class LBPEvaluator CV_FINAL : public FeatureEvaluator
@@ -412,7 +412,7 @@ public:
Feature( int x, int y, int _block_w, int _block_h ) :
rect(x, y, _block_w, _block_h) {}

- bool read(const FileNode& node );
+ bool read(const FileNode& node, const Size& origWinSize);

Rect rect; // weight and height for block
};

Loading

0 comments on commit 637967e

Please sign in to comment.