From b45e784bebe318826bb48a41023db3fe1660d91e Mon Sep 17 00:00:00 2001 From: jexner Date: Thu, 23 Mar 2017 18:48:59 +0100 Subject: [PATCH] Fix segmentation fault in cv::Mat::forEach This issue concerns only matrices with more dimensions than columns. See https://github.com/opencv/opencv/issues/8447 --- modules/core/include/opencv2/core/utility.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/include/opencv2/core/utility.hpp b/modules/core/include/opencv2/core/utility.hpp index 93d599c..bc33f03 100644 --- a/modules/core/include/opencv2/core/utility.hpp +++ b/modules/core/include/opencv2/core/utility.hpp @@ -507,7 +507,7 @@ void Mat::forEach_impl(const Functor& operation) { this->rowCall2(row, COLS); } } else { - std::vector idx(COLS); /// idx is modified in this->rowCall + std::vector idx(DIMS); /// idx is modified in this->rowCall idx[DIMS - 2] = range.start - 1; for (int line_num = range.start; line_num < range.end; ++line_num) { -- 2.7.4