From 48a5599c5ec0970cfaa5d28efe449ff28b182fda Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 17 Jun 2011 16:14:47 +0000 Subject: [PATCH] fixed potentially incorrect memory access in cv::transform --- modules/core/src/matmul.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/core/src/matmul.cpp b/modules/core/src/matmul.cpp index a1f89eb..28767bf 100644 --- a/modules/core/src/matmul.cpp +++ b/modules/core/src/matmul.cpp @@ -1743,12 +1743,13 @@ void cv::transform( InputArray _src, OutputArray _dst, InputArray _mtx ) int mtype = depth == CV_32S || depth == CV_64F ? CV_64F : CV_32F; AutoBuffer _mbuf; - double* mbuf = _mbuf; + double* mbuf; if( !m.isContinuous() || m.type() != mtype || m.cols != scn + 1 ) { _mbuf.allocate(dcn*(scn+1)); - Mat tmp(dcn, scn+1, mtype, (double*)_mbuf); + mbuf = (double*)_mbuf; + Mat tmp(dcn, scn+1, mtype, mbuf); memset(tmp.data, 0, tmp.total()*tmp.elemSize()); if( m.cols == scn+1 ) m.convertTo(tmp, mtype); -- 2.7.4