diff --git a/modules/core/src/cuda_gpu_mat.cpp b/modules/core/src/cuda_gpu_mat.cpp index 84b5b210d1..e201f0aca3 100644 --- a/modules/core/src/cuda_gpu_mat.cpp +++ b/modules/core/src/cuda_gpu_mat.cpp @@ -149,9 +149,9 @@ cv::cuda::GpuMat::GpuMat(const GpuMat& m, Rect roi) : { data += roi.x * elemSize(); - CV_Assert( 0 <= roi.x && 0 <= roi.width && + CV_Assert( 0 <= roi.x && 0 < roi.width && roi.x + roi.width <= m.cols && - 0 <= roi.y && 0 <= roi.height && + 0 <= roi.y && 0 < roi.height && roi.y + roi.height <= m.rows ); if (refcount)