Merge pull request #16992 from afowles:fix-forEach-segfault

* Fixed divide by zero error in forEach

* Dedicated assertion for !empty
pull/16996/head^2
Adam Fowles 5 years ago committed by GitHub
parent 99d29c9d39
commit 8334932a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      modules/core/include/opencv2/core/utility.hpp

@ -622,6 +622,7 @@ void Mat::forEach_impl(const Functor& operation) {
// or (_Tp&, void*) <- in case you don't need current idx.
}
CV_Assert(!empty());
CV_Assert(this->total() / this->size[this->dims - 1] <= INT_MAX);
const int LINES = static_cast<int>(this->total() / this->size[this->dims - 1]);

Loading…
Cancel
Save