fix copyTo memory corruption, but the main problem is still here

This commit is contained in:
Alexander Alekhin
2015-07-01 20:08:36 +03:00
parent 30a5a9ed34
commit 885114ed2c
4 changed files with 11 additions and 1 deletions

View File

@@ -285,6 +285,11 @@ void Mat::copyTo( OutputArray _dst ) const
if( rows > 0 && cols > 0 )
{
// For some cases (with vector) dst.size != src.size, so force to column-based form
// It prevents memory corruption in case of column-based src
if (_dst.isVector())
dst = dst.reshape(0, (int)dst.total());
const uchar* sptr = data;
uchar* dptr = dst.data;