Blame SOURCES/opencv-3.4.6-cvSaveImage.patch

475389
From 6e1da2ef91907678159d40f600a56094c4d196b9 Mon Sep 17 00:00:00 2001
475389
From: Zhuo Zhang <zchrissirhcz@gmail.com>
475389
Date: Fri, 25 Dec 2020 00:58:16 +0800
475389
Subject: [PATCH] Merge pull request #19203 from zchrissirhcz:fix-cvSaveImage
475389
475389
Fix cvSaveImage( ) function bug
475389
475389
* fix cvSaveImage crash
475389
475389
* replace emplace_back with {}, no C++11 required
475389
475389
* fix MacOSX build with vector's push_back
475389
---
475389
 modules/imgcodecs/src/loadsave.cpp | 4 +++-
475389
 1 file changed, 3 insertions(+), 1 deletion(-)
475389
475389
diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp
475389
index 4e626cd2165b..44c458c7273c 100644
475389
--- a/modules/imgcodecs/src/loadsave.cpp
475389
+++ b/modules/imgcodecs/src/loadsave.cpp
475389
@@ -1001,7 +1001,9 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params )
475389
         for( ; _params[i] > 0; i += 2 )
475389
             CV_Assert(static_cast<size_t>(i) < cv::CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
475389
     }
475389
-    return cv::imwrite_(filename, cv::cvarrToMat(arr),
475389
+    std::vector<cv::Mat> img_vec;
475389
+    img_vec.push_back(cv::cvarrToMat(arr));
475389
+    return cv::imwrite_(filename, img_vec,
475389
         i > 0 ? std::vector<int>(_params, _params+i) : std::vector<int>(),
475389
         CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL );
475389
 }