mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-01-01 13:58:06 +00:00
opencv: refresh patches with devtool to apply cleanly
* 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 <Martin.Jansa@gmail.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
parent
7796f4ce08
commit
637967e804
|
|
@ -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 <ricardo.ribalda@gmail.com>
|
||||
Date: Thu, 31 Mar 2016 00:20:15 +0200
|
||||
Subject: [PATCH] 3rdparty/ippicv: Use pre-downloaded ipp
|
||||
|
|
@ -11,7 +11,7 @@ Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -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 <raj.khem@gmail.com>
|
||||
Date: Tue, 11 Sep 2018 00:21:18 -0700
|
||||
Subject: [PATCH] Dont use isystem
|
||||
|
|
@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -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 <jason.wessel@windriver.com>
|
||||
Date: Wed, 9 May 2018 13:33:59 -0700
|
||||
Subject: [PATCH] Temporarliy work around deprecated ffmpeg RAW function
|
||||
|
|
@ -11,7 +11,7 @@ Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
|
|||
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
|
||||
|
|
|
|||
|
|
@ -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 <raj.khem@gmail.com>
|
||||
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 <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
3rdparty/carotene/CMakeLists.txt | 8 ++++++--
|
||||
3rdparty/carotene/hal/CMakeLists.txt | 7 ++++++-
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <biannm@cn.fujitsu.com>
|
||||
Date: Wed, 19 Apr 2017 03:11:37 +0900
|
||||
Subject: [PATCH] Make opencv-ts create share library intead of static.
|
||||
|
|
@ -10,7 +10,7 @@ Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -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 <huangqy.fnst@cn.fujitsu.com>
|
||||
Date: Fri, 19 May 2017 04:27:50 +0900
|
||||
Subject: [PATCH] To fix errors as following:
|
||||
|
|
@ -21,7 +21,7 @@ Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
|
|||
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:
|
||||
|
|
@ -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)
|
||||
|
|
@ -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 @@
|
||||
|
|
|
|||
|
|
@ -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 <alexander.alekhin@intel.com>
|
||||
Date: Thu, 25 Jul 2019 17:15:59 +0300
|
||||
Subject: [PATCH] objdetect: validate feature rectangle on reading
|
||||
|
|
@ -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 <Neetika.Singh@kpit.com>
|
||||
|
||||
---
|
||||
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;
|
||||
+
|
||||
|
|
@ -62,10 +63,10 @@ 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))
|
||||
|
|
@ -73,9 +74,9 @@ index 4b2078306fe..bd62cd21a1b 100644
|
|||
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)
|
||||
|
|
@ -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++)
|
||||
{
|
||||
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
From 5691d998ead1d9b0542bcfced36c2dceb3a59023 Mon Sep 17 00:00:00 2001
|
||||
From 0d88c87ed94e89af490c3d882597e034422aa4a5 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Alekhin <alexander.alekhin@intel.com>
|
||||
Date: Thu, 25 Jul 2019 15:14:22 +0300
|
||||
Subject: [PATCH] core(persistence): added null ptr checks
|
||||
|
|
@ -8,6 +8,7 @@ Upstream-Status: Backport [https://github.com/opencv/opencv/commit/5691d998ead1d
|
|||
Comment: No changes in any hunk
|
||||
|
||||
Signed-off-by: Neetika Singh <Neetika.Singh@kpit.com>
|
||||
|
||||
---
|
||||
modules/core/src/persistence_json.cpp | 12 ++++++++++++
|
||||
modules/core/src/persistence_xml.cpp | 21 +++++++++++++++++++++
|
||||
|
|
@ -15,11 +16,11 @@ Signed-off-by: Neetika Singh <Neetika.Singh@kpit.com>
|
|||
3 files changed, 54 insertions(+)
|
||||
|
||||
diff --git a/modules/core/src/persistence_json.cpp b/modules/core/src/persistence_json.cpp
|
||||
index ae678e1b8b1..89914e6534f 100644
|
||||
index ae678e1b8b..89914e6534 100644
|
||||
--- a/modules/core/src/persistence_json.cpp
|
||||
+++ b/modules/core/src/persistence_json.cpp
|
||||
@@ -296,6 +296,8 @@ class JSONParser : public FileStorageParser
|
||||
|
||||
@@ -296,6 +296,8 @@ public:
|
||||
|
||||
while ( is_eof == false && is_completed == false )
|
||||
{
|
||||
+ if (!ptr)
|
||||
|
|
@ -27,7 +28,7 @@ index ae678e1b8b1..89914e6534f 100644
|
|||
switch ( *ptr )
|
||||
{
|
||||
/* comment */
|
||||
@@ -381,6 +383,7 @@ class JSONParser : public FileStorageParser
|
||||
@@ -381,6 +383,7 @@ public:
|
||||
if ( is_eof || !is_completed )
|
||||
{
|
||||
ptr = fs->bufferStart();
|
||||
|
|
@ -35,8 +36,8 @@ index ae678e1b8b1..89914e6534f 100644
|
|||
*ptr = '\0';
|
||||
fs->setEof();
|
||||
if( !is_completed )
|
||||
@@ -392,6 +395,9 @@ class JSONParser : public FileStorageParser
|
||||
|
||||
@@ -392,6 +395,9 @@ public:
|
||||
|
||||
char* parseKey( char* ptr, FileNode& collection, FileNode& value_placeholder )
|
||||
{
|
||||
+ if (!ptr)
|
||||
|
|
@ -44,9 +45,9 @@ index ae678e1b8b1..89914e6534f 100644
|
|||
+
|
||||
if( *ptr != '"' )
|
||||
CV_PARSE_ERROR_CPP( "Key must start with \'\"\'" );
|
||||
|
||||
@@ -430,6 +436,9 @@ class JSONParser : public FileStorageParser
|
||||
|
||||
|
||||
@@ -430,6 +436,9 @@ public:
|
||||
|
||||
char* parseValue( char* ptr, FileNode& node )
|
||||
{
|
||||
+ if (!ptr)
|
||||
|
|
@ -55,8 +56,8 @@ index ae678e1b8b1..89914e6534f 100644
|
|||
ptr = skipSpaces( ptr );
|
||||
if( !ptr || !*ptr )
|
||||
CV_PARSE_ERROR_CPP( "Unexpected End-Of-File" );
|
||||
@@ -817,6 +826,9 @@ class JSONParser : public FileStorageParser
|
||||
|
||||
@@ -817,6 +826,9 @@ public:
|
||||
|
||||
bool parse( char* ptr )
|
||||
{
|
||||
+ if (!ptr)
|
||||
|
|
@ -66,21 +67,21 @@ index ae678e1b8b1..89914e6534f 100644
|
|||
if ( !ptr || !*ptr )
|
||||
return false;
|
||||
diff --git a/modules/core/src/persistence_xml.cpp b/modules/core/src/persistence_xml.cpp
|
||||
index fb30d90896e..89876dd3da8 100644
|
||||
index fb30d90896..89876dd3da 100644
|
||||
--- a/modules/core/src/persistence_xml.cpp
|
||||
+++ b/modules/core/src/persistence_xml.cpp
|
||||
@@ -360,6 +360,9 @@ class XMLParser : public FileStorageParser
|
||||
|
||||
@@ -360,6 +360,9 @@ public:
|
||||
|
||||
char* skipSpaces( char* ptr, int mode )
|
||||
{
|
||||
+ if (!ptr)
|
||||
+ CV_PARSE_ERROR_CPP("Invalid input");
|
||||
+
|
||||
int level = 0;
|
||||
|
||||
|
||||
for(;;)
|
||||
@@ -441,6 +444,9 @@ class XMLParser : public FileStorageParser
|
||||
|
||||
@@ -441,6 +444,9 @@ public:
|
||||
|
||||
char* parseValue( char* ptr, FileNode& node )
|
||||
{
|
||||
+ if (!ptr)
|
||||
|
|
@ -89,7 +90,7 @@ index fb30d90896e..89876dd3da8 100644
|
|||
FileNode new_elem;
|
||||
bool have_space = true;
|
||||
int value_type = node.type();
|
||||
@@ -456,6 +462,8 @@ class XMLParser : public FileStorageParser
|
||||
@@ -456,6 +462,8 @@ public:
|
||||
(c == '<' && ptr[1] == '!' && ptr[2] == '-') )
|
||||
{
|
||||
ptr = skipSpaces( ptr, 0 );
|
||||
|
|
@ -98,16 +99,16 @@ index fb30d90896e..89876dd3da8 100644
|
|||
have_space = true;
|
||||
c = *ptr;
|
||||
}
|
||||
@@ -502,6 +510,8 @@ class XMLParser : public FileStorageParser
|
||||
@@ -502,6 +510,8 @@ public:
|
||||
{
|
||||
ptr = fs->parseBase64( ptr, 0, new_elem);
|
||||
ptr = skipSpaces( ptr, 0 );
|
||||
+ if (!ptr)
|
||||
+ CV_PARSE_ERROR_CPP("Invalid input");
|
||||
}
|
||||
|
||||
|
||||
ptr = parseTag( ptr, key2, type_name, tag_type );
|
||||
@@ -645,6 +655,9 @@ class XMLParser : public FileStorageParser
|
||||
@@ -645,6 +655,9 @@ public:
|
||||
char* parseTag( char* ptr, std::string& tag_name,
|
||||
std::string& type_name, int& tag_type )
|
||||
{
|
||||
|
|
@ -116,8 +117,8 @@ index fb30d90896e..89876dd3da8 100644
|
|||
+
|
||||
if( *ptr == '\0' )
|
||||
CV_PARSE_ERROR_CPP( "Unexpected end of the stream" );
|
||||
|
||||
@@ -702,6 +715,8 @@ class XMLParser : public FileStorageParser
|
||||
|
||||
@@ -702,6 +715,8 @@ public:
|
||||
if( *ptr != '=' )
|
||||
{
|
||||
ptr = skipSpaces( ptr, CV_XML_INSIDE_TAG );
|
||||
|
|
@ -126,7 +127,7 @@ index fb30d90896e..89876dd3da8 100644
|
|||
if( *ptr != '=' )
|
||||
CV_PARSE_ERROR_CPP( "Attribute name should be followed by \'=\'" );
|
||||
}
|
||||
@@ -740,6 +755,8 @@ class XMLParser : public FileStorageParser
|
||||
@@ -740,6 +755,8 @@ public:
|
||||
if( c != '>' )
|
||||
{
|
||||
ptr = skipSpaces( ptr, CV_XML_INSIDE_TAG );
|
||||
|
|
@ -134,31 +135,31 @@ index fb30d90896e..89876dd3da8 100644
|
|||
+ CV_PARSE_ERROR_CPP("Invalid input");
|
||||
c = *ptr;
|
||||
}
|
||||
|
||||
@@ -781,6 +798,8 @@ class XMLParser : public FileStorageParser
|
||||
|
||||
|
||||
@@ -781,6 +798,8 @@ public:
|
||||
|
||||
// CV_XML_INSIDE_TAG is used to prohibit leading comments
|
||||
ptr = skipSpaces( ptr, CV_XML_INSIDE_TAG );
|
||||
+ if (!ptr)
|
||||
+ CV_PARSE_ERROR_CPP("Invalid input");
|
||||
|
||||
|
||||
if( memcmp( ptr, "<?xml", 5 ) != 0 ) // FIXIT ptr[1..] - out of bounds read without check
|
||||
CV_PARSE_ERROR_CPP( "Valid XML should start with \'<?xml ...?>\'" );
|
||||
@@ -791,6 +810,8 @@ class XMLParser : public FileStorageParser
|
||||
@@ -791,6 +810,8 @@ public:
|
||||
while( ptr && *ptr != '\0' )
|
||||
{
|
||||
ptr = skipSpaces( ptr, 0 );
|
||||
+ if (!ptr)
|
||||
+ CV_PARSE_ERROR_CPP("Invalid input");
|
||||
|
||||
|
||||
if( *ptr != '\0' )
|
||||
{
|
||||
diff --git a/modules/core/src/persistence_yml.cpp b/modules/core/src/persistence_yml.cpp
|
||||
index 4129ca1dc57..7742e827701 100644
|
||||
index 4129ca1dc5..7742e82770 100644
|
||||
--- a/modules/core/src/persistence_yml.cpp
|
||||
+++ b/modules/core/src/persistence_yml.cpp
|
||||
@@ -330,6 +330,9 @@ class YAMLParser : public FileStorageParser
|
||||
|
||||
@@ -330,6 +330,9 @@ public:
|
||||
|
||||
char* skipSpaces( char* ptr, int min_indent, int max_comment_indent )
|
||||
{
|
||||
+ if (!ptr)
|
||||
|
|
@ -167,8 +168,8 @@ index 4129ca1dc57..7742e827701 100644
|
|||
for(;;)
|
||||
{
|
||||
while( *ptr == ' ' )
|
||||
@@ -374,6 +377,9 @@ class YAMLParser : public FileStorageParser
|
||||
|
||||
@@ -374,6 +377,9 @@ public:
|
||||
|
||||
bool getBase64Row(char* ptr, int indent, char* &beg, char* &end)
|
||||
{
|
||||
+ if (!ptr)
|
||||
|
|
@ -177,8 +178,8 @@ index 4129ca1dc57..7742e827701 100644
|
|||
beg = end = ptr = skipSpaces(ptr, 0, INT_MAX);
|
||||
if (!ptr || !*ptr)
|
||||
return false; // end of file
|
||||
@@ -394,6 +400,9 @@ class YAMLParser : public FileStorageParser
|
||||
|
||||
@@ -394,6 +400,9 @@ public:
|
||||
|
||||
char* parseKey( char* ptr, FileNode& map_node, FileNode& value_placeholder )
|
||||
{
|
||||
+ if (!ptr)
|
||||
|
|
@ -186,9 +187,9 @@ index 4129ca1dc57..7742e827701 100644
|
|||
+
|
||||
char c;
|
||||
char *endptr = ptr - 1, *saveptr;
|
||||
|
||||
@@ -422,6 +431,9 @@ class YAMLParser : public FileStorageParser
|
||||
|
||||
|
||||
@@ -422,6 +431,9 @@ public:
|
||||
|
||||
char* parseValue( char* ptr, FileNode& node, int min_indent, bool is_parent_flow )
|
||||
{
|
||||
+ if (!ptr)
|
||||
|
|
@ -197,35 +198,35 @@ index 4129ca1dc57..7742e827701 100644
|
|||
char* endptr = 0;
|
||||
char c = ptr[0], d = ptr[1];
|
||||
int value_type = FileNode::NONE;
|
||||
@@ -508,6 +520,8 @@ class YAMLParser : public FileStorageParser
|
||||
|
||||
@@ -508,6 +520,8 @@ public:
|
||||
|
||||
*endptr = d;
|
||||
ptr = skipSpaces( endptr, min_indent, INT_MAX );
|
||||
+ if (!ptr)
|
||||
+ CV_PARSE_ERROR_CPP("Invalid input");
|
||||
|
||||
|
||||
c = *ptr;
|
||||
|
||||
@@ -634,6 +648,8 @@ class YAMLParser : public FileStorageParser
|
||||
|
||||
@@ -634,6 +648,8 @@ public:
|
||||
FileNode elem;
|
||||
|
||||
|
||||
ptr = skipSpaces( ptr, new_min_indent, INT_MAX );
|
||||
+ if (!ptr)
|
||||
+ CV_PARSE_ERROR_CPP("Invalid input");
|
||||
if( *ptr == '}' || *ptr == ']' )
|
||||
{
|
||||
if( *ptr != d )
|
||||
@@ -647,6 +663,8 @@ class YAMLParser : public FileStorageParser
|
||||
@@ -647,6 +663,8 @@ public:
|
||||
if( *ptr != ',' )
|
||||
CV_PARSE_ERROR_CPP( "Missing , between the elements" );
|
||||
ptr = skipSpaces( ptr + 1, new_min_indent, INT_MAX );
|
||||
+ if (!ptr)
|
||||
+ CV_PARSE_ERROR_CPP("Invalid input");
|
||||
}
|
||||
|
||||
|
||||
if( struct_type == FileNode::MAP )
|
||||
@@ -746,6 +764,9 @@ class YAMLParser : public FileStorageParser
|
||||
|
||||
@@ -746,6 +764,9 @@ public:
|
||||
|
||||
bool parse( char* ptr )
|
||||
{
|
||||
+ if (!ptr)
|
||||
|
|
@ -234,4 +235,3 @@ index 4129ca1dc57..7742e827701 100644
|
|||
bool first = true;
|
||||
bool ok = true;
|
||||
FileNode root_collection(fs->getFS(), 0, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
From 5a497077f109d543ab86dfdf8add1c76c0e47d29 Mon Sep 17 00:00:00 2001
|
||||
From 384c5fa5f09aec5512343340fe65ccaaf83dfc48 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Alekhin <alexander.alekhin@intel.com>
|
||||
Date: Fri, 23 Aug 2019 16:14:53 +0300
|
||||
Subject: [PATCH] objdetect: add input check in HOG detector
|
||||
|
|
@ -8,24 +8,25 @@ Upstream-Status: Backport [https://github.com/opencv/opencv/commit/5a497077f109d
|
|||
Comment: No changes in any hunk
|
||||
|
||||
Signed-off-by: Neetika Singh <Neetika.Singh@kpit.com>
|
||||
|
||||
---
|
||||
modules/objdetect/src/hog.cpp | 19 ++++++++++++-------
|
||||
1 file changed, 12 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/modules/objdetect/src/hog.cpp b/modules/objdetect/src/hog.cpp
|
||||
index 9524851eebb..378bab30876 100644
|
||||
index e3e43bb86e..af814658fe 100644
|
||||
--- a/modules/objdetect/src/hog.cpp
|
||||
+++ b/modules/objdetect/src/hog.cpp
|
||||
@@ -68,6 +68,7 @@ enum {DESCR_FORMAT_COL_BY_COL, DESCR_FORMAT_ROW_BY_ROW};
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace cv
|
||||
|
||||
static int numPartsWithin(int size, int part_size, int stride)
|
||||
{
|
||||
+ CV_Assert(stride != 0);
|
||||
return (size - part_size + stride) / stride;
|
||||
}
|
||||
|
||||
@@ -80,13 +81,17 @@ static Size numPartsWithin(cv::Size size, cv::Size part_size,
|
||||
|
||||
|
||||
@@ -77,13 +78,17 @@ static Size numPartsWithin(cv::Size size, cv::Size part_size,
|
||||
|
||||
static size_t getBlockHistogramSize(Size block_size, Size cell_size, int nbins)
|
||||
{
|
||||
+ CV_Assert(!cell_size.empty());
|
||||
|
|
@ -34,7 +35,7 @@ index 9524851eebb..378bab30876 100644
|
|||
+ block_size.height / cell_size.height);
|
||||
return (size_t)(nbins * cells_per_block.area());
|
||||
}
|
||||
|
||||
|
||||
size_t HOGDescriptor::getDescriptorSize() const
|
||||
{
|
||||
+ CV_Assert(!cellSize.empty());
|
||||
|
|
@ -43,7 +44,7 @@ index 9524851eebb..378bab30876 100644
|
|||
CV_Assert(blockSize.width % cellSize.width == 0 &&
|
||||
blockSize.height % cellSize.height == 0);
|
||||
CV_Assert((winSize.width - blockSize.width) % blockStride.width == 0 &&
|
||||
@@ -144,20 +149,20 @@ bool HOGDescriptor::read(FileNode& obj)
|
||||
@@ -141,20 +146,20 @@ bool HOGDescriptor::read(FileNode& obj)
|
||||
if( !obj.isMap() )
|
||||
return false;
|
||||
FileNodeIterator it = obj["winSize"].begin();
|
||||
|
|
@ -70,4 +71,3 @@ index 9524851eebb..378bab30876 100644
|
|||
if (obj["signedGradient"].empty())
|
||||
signedGradient = false;
|
||||
else
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
From d1615ba11a93062b1429fce9f0f638d1572d3418 Mon Sep 17 00:00:00 2001
|
||||
From 34195a57528a3f2c807bc3eeb8c934b8ea8289bd Mon Sep 17 00:00:00 2001
|
||||
From: Thang Tran <TranKimThang279@gmail.com>
|
||||
Date: Mon, 27 May 2019 08:18:26 +0200
|
||||
Subject: [PATCH] video:fixed DISOpticalFlow segfault from small img
|
||||
|
|
@ -8,13 +8,14 @@ Upstream-Status: Backport [https://github.com/opencv/opencv/commit/d1615ba11a930
|
|||
Comment: No changes in any hunk
|
||||
|
||||
Signed-off-by: Neetika Singh <Neetika.Singh@kpit.com>
|
||||
|
||||
---
|
||||
modules/video/src/dis_flow.cpp | 67 ++++++++++++++++++++++++-
|
||||
modules/video/test/test_OF_accuracy.cpp | 28 +++++++++++
|
||||
2 files changed, 93 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/modules/video/src/dis_flow.cpp b/modules/video/src/dis_flow.cpp
|
||||
index a453d8b2b51..806d6f1ddaf 100644
|
||||
index b86df1564b..adafcc92d8 100644
|
||||
--- a/modules/video/src/dis_flow.cpp
|
||||
+++ b/modules/video/src/dis_flow.cpp
|
||||
@@ -140,6 +140,8 @@ class DISOpticalFlowImpl CV_FINAL : public DISOpticalFlow
|
||||
|
|
@ -23,13 +24,13 @@ index a453d8b2b51..806d6f1ddaf 100644
|
|||
Mat &I0y);
|
||||
+ int autoSelectCoarsestScale(int img_width);
|
||||
+ void autoSelectPatchSizeAndScales(int img_width);
|
||||
|
||||
|
||||
struct PatchInverseSearch_ParBody : public ParallelLoopBody
|
||||
{
|
||||
@@ -435,6 +437,44 @@ void DISOpticalFlowImpl::precomputeStructureTensor(Mat &dst_I0xx, Mat &dst_I0yy,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+int DISOpticalFlowImpl::autoSelectCoarsestScale(int img_width)
|
||||
+{
|
||||
+ const int fratio = 5;
|
||||
|
|
@ -71,14 +72,14 @@ index a453d8b2b51..806d6f1ddaf 100644
|
|||
DISOpticalFlowImpl::PatchInverseSearch_ParBody::PatchInverseSearch_ParBody(DISOpticalFlowImpl &_dis, int _nstripes,
|
||||
int _hs, Mat &dst_Sx, Mat &dst_Sy,
|
||||
Mat &src_Ux, Mat &src_Uy, Mat &_I0, Mat &_I1,
|
||||
@@ -1318,9 +1358,20 @@ bool DISOpticalFlowImpl::ocl_calc(InputArray I0, InputArray I1, InputOutputArray
|
||||
@@ -1313,9 +1353,20 @@ bool DISOpticalFlowImpl::ocl_calc(InputArray I0, InputArray I1, InputOutputArray
|
||||
else
|
||||
flow.create(I1Mat.size(), CV_32FC2);
|
||||
UMat &u_flowMat = flow.getUMatRef();
|
||||
- coarsest_scale = min((int)(log(max(I0Mat.cols, I0Mat.rows) / (4.0 * patch_size)) / log(2.0) + 0.5), /* Original code serach for maximal movement of width/4 */
|
||||
+ coarsest_scale = min((int)(log(max(I0Mat.cols, I0Mat.rows) / (4.0 * patch_size)) / log(2.0) + 0.5), /* Original code search for maximal movement of width/4 */
|
||||
(int)(log(min(I0Mat.cols, I0Mat.rows) / patch_size) / log(2.0))); /* Deepest pyramid level greater or equal than patch*/
|
||||
|
||||
|
||||
+ if (coarsest_scale<0)
|
||||
+ CV_Error(cv::Error::StsBadSize, "The input image must have either width or height >= 12");
|
||||
+
|
||||
|
|
@ -93,7 +94,7 @@ index a453d8b2b51..806d6f1ddaf 100644
|
|||
ocl_prepareBuffers(I0Mat, I1Mat, u_flowMat, use_input_flow);
|
||||
u_Ux[coarsest_scale].setTo(0.0f);
|
||||
u_Uy[coarsest_scale].setTo(0.0f);
|
||||
@@ -1385,8 +1436,20 @@ void DISOpticalFlowImpl::calc(InputArray I0, InputArray I1, InputOutputArray flo
|
||||
@@ -1380,8 +1431,20 @@ void DISOpticalFlowImpl::calc(InputArray I0, InputArray I1, InputOutputArray flo
|
||||
else
|
||||
flow.create(I1Mat.size(), CV_32FC2);
|
||||
Mat flowMat = flow.getMat();
|
||||
|
|
@ -113,16 +114,16 @@ index a453d8b2b51..806d6f1ddaf 100644
|
|||
+ }
|
||||
+
|
||||
int num_stripes = getNumThreads();
|
||||
|
||||
|
||||
prepareBuffers(I0Mat, I1Mat, flowMat, use_input_flow);
|
||||
diff --git a/modules/video/test/test_OF_accuracy.cpp b/modules/video/test/test_OF_accuracy.cpp
|
||||
index affbab65866..b99ffce2a8b 100644
|
||||
index affbab6586..b99ffce2a8 100644
|
||||
--- a/modules/video/test/test_OF_accuracy.cpp
|
||||
+++ b/modules/video/test/test_OF_accuracy.cpp
|
||||
@@ -121,6 +121,34 @@ TEST(DenseOpticalFlow_DIS, ReferenceAccuracy)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+TEST(DenseOpticalFlow_DIS, InvalidImgSize_CoarsestLevelLessThanZero)
|
||||
+{
|
||||
+ cv::Ptr<cv::DISOpticalFlow> of = cv::DISOpticalFlow::create();
|
||||
|
|
@ -154,4 +155,3 @@ index affbab65866..b99ffce2a8b 100644
|
|||
TEST(DenseOpticalFlow_VariationalRefinement, ReferenceAccuracy)
|
||||
{
|
||||
Mat frame1, frame2, GT;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
From 3b1a69503dea2075d51655a0cea5369c88a67632 Mon Sep 17 00:00:00 2001
|
||||
From: Ross Burton <ross.burton@intel.com>
|
||||
Date: Thu, 9 Jan 2020 16:24:24 +0000
|
||||
Subject: [PATCH] opencv: abort configure if we need to download
|
||||
|
||||
This CMake module will download files during do_configure. This is bad as it
|
||||
means we can't do offline builds.
|
||||
|
||||
|
|
@ -6,6 +11,10 @@ Add an option to disallow downloads by emitting a fatal error.
|
|||
Upstream-Status: Pending
|
||||
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
||||
|
||||
---
|
||||
cmake/OpenCVDownload.cmake | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake
|
||||
index cdc47ad2cb..74573f45a2 100644
|
||||
--- a/cmake/OpenCVDownload.cmake
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user