fixed potentially incorrect memory access in cv::transform
This commit is contained in:
parent
98e13cec87
commit
48a5599c5e
@ -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;
|
int mtype = depth == CV_32S || depth == CV_64F ? CV_64F : CV_32F;
|
||||||
AutoBuffer<double> _mbuf;
|
AutoBuffer<double> _mbuf;
|
||||||
double* mbuf = _mbuf;
|
double* mbuf;
|
||||||
|
|
||||||
if( !m.isContinuous() || m.type() != mtype || m.cols != scn + 1 )
|
if( !m.isContinuous() || m.type() != mtype || m.cols != scn + 1 )
|
||||||
{
|
{
|
||||||
_mbuf.allocate(dcn*(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());
|
memset(tmp.data, 0, tmp.total()*tmp.elemSize());
|
||||||
if( m.cols == scn+1 )
|
if( m.cols == scn+1 )
|
||||||
m.convertTo(tmp, mtype);
|
m.convertTo(tmp, mtype);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user