diff --git a/SOURCES/opencv-3.4.6-cvSaveImage.patch b/SOURCES/opencv-3.4.6-cvSaveImage.patch new file mode 100644 index 0000000..826d4b0 --- /dev/null +++ b/SOURCES/opencv-3.4.6-cvSaveImage.patch @@ -0,0 +1,31 @@ +From 6e1da2ef91907678159d40f600a56094c4d196b9 Mon Sep 17 00:00:00 2001 +From: Zhuo Zhang +Date: Fri, 25 Dec 2020 00:58:16 +0800 +Subject: [PATCH] Merge pull request #19203 from zchrissirhcz:fix-cvSaveImage + +Fix cvSaveImage( ) function bug + +* fix cvSaveImage crash + +* replace emplace_back with {}, no C++11 required + +* fix MacOSX build with vector's push_back +--- + modules/imgcodecs/src/loadsave.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp +index 4e626cd2165b..44c458c7273c 100644 +--- a/modules/imgcodecs/src/loadsave.cpp ++++ b/modules/imgcodecs/src/loadsave.cpp +@@ -1001,7 +1001,9 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params ) + for( ; _params[i] > 0; i += 2 ) + CV_Assert(static_cast(i) < cv::CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons + } +- return cv::imwrite_(filename, cv::cvarrToMat(arr), ++ std::vector img_vec; ++ img_vec.push_back(cv::cvarrToMat(arr)); ++ return cv::imwrite_(filename, img_vec, + i > 0 ? std::vector(_params, _params+i) : std::vector(), + CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL ); + } diff --git a/SPECS/opencv.spec b/SPECS/opencv.spec index f715d30..38d7bc3 100644 --- a/SPECS/opencv.spec +++ b/SPECS/opencv.spec @@ -54,7 +54,7 @@ Name: opencv Version: 3.4.6 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Collection of algorithms for computer vision # This is normal three clause BSD. License: BSD @@ -69,6 +69,8 @@ Source1: %{name}_contrib-clean-%{version}.tar.gz # fix/simplify cmake config install location (upstreamable) # https://bugzilla.redhat.com/1031312 Patch1: opencv-3.4.6-install_3rdparty_licenses.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2104776 +Patch2: opencv-3.4.6-cvSaveImage.patch BuildRequires: libtool BuildRequires: cmake >= 2.6.3 BuildRequires: chrpath @@ -214,6 +216,7 @@ to provide decent performance and stability. rm -r 3rdparty/ %patch1 -p1 -b .install_3rdparty_licenses +%patch2 -p1 -b .cvSaveImage %build export RHEL_ALLOW_PYTHON2_FOR_BUILD=1 @@ -373,6 +376,10 @@ popd %{_libdir}/libopencv_xphoto.so.%{abiver}* %changelog +* Wed Aug 03 2022 Jiri Kucera - 3.4.6-8 +- Fix cvSaveImage + Resolves: #2104776 + * Fri Jan 07 2022 Jiri Kucera - 3.4.6-7 - Add DNN support Resolves: #2007780