From 645bb0bfbc0a4454903e65d62b5a173b4f3feb36 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Wed, 10 Aug 2011 12:40:41 +0000 Subject: [PATCH] added size check to static Mat::diag() --- modules/core/include/opencv2/core/mat.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/core/include/opencv2/core/mat.hpp b/modules/core/include/opencv2/core/mat.hpp index acd290ec47..6f444e4ed2 100644 --- a/modules/core/include/opencv2/core/mat.hpp +++ b/modules/core/include/opencv2/core/mat.hpp @@ -338,6 +338,7 @@ inline Mat Mat::colRange(const Range& r) const inline Mat Mat::diag(const Mat& d) { + CV_Assert( d.cols == 1 ); Mat m(d.rows, d.rows, d.type(), Scalar(0)), md = m.diag(); d.copyTo(md); return m;