Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
885114ed
Commit
885114ed
authored
Jul 01, 2015
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix copyTo memory corruption, but the main problem is still here
parent
30a5a9ed
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
1 deletion
+11
-1
mat.hpp
modules/core/include/opencv2/core/mat.hpp
+1
-0
mat.inl.hpp
modules/core/include/opencv2/core/mat.inl.hpp
+1
-0
copy.cpp
modules/core/src/copy.cpp
+5
-0
test_mat.cpp
modules/core/test/test_mat.cpp
+4
-1
No files found.
modules/core/include/opencv2/core/mat.hpp
View file @
885114ed
...
...
@@ -222,6 +222,7 @@ public:
bool
isMatVector
()
const
;
bool
isUMatVector
()
const
;
bool
isMatx
()
const
;
bool
isVector
()
const
;
~
_InputArray
();
...
...
modules/core/include/opencv2/core/mat.inl.hpp
View file @
885114ed
...
...
@@ -130,6 +130,7 @@ inline bool _InputArray::isUMat() const { return kind() == _InputArray::UMAT; }
inline
bool
_InputArray
::
isMatVector
()
const
{
return
kind
()
==
_InputArray
::
STD_VECTOR_MAT
;
}
inline
bool
_InputArray
::
isUMatVector
()
const
{
return
kind
()
==
_InputArray
::
STD_VECTOR_UMAT
;
}
inline
bool
_InputArray
::
isMatx
()
const
{
return
kind
()
==
_InputArray
::
MATX
;
}
inline
bool
_InputArray
::
isVector
()
const
{
return
kind
()
==
_InputArray
::
STD_VECTOR
||
kind
()
==
_InputArray
::
STD_BOOL_VECTOR
;
}
////////////////////////////////////////////////////////////////////////////////////////
...
...
modules/core/src/copy.cpp
View file @
885114ed
...
...
@@ -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
;
...
...
modules/core/test/test_mat.cpp
View file @
885114ed
...
...
@@ -1320,7 +1320,8 @@ TEST(Core_SparseMat, footprint)
}
TEST
(
Core_Mat_vector
,
OutputArray_create_getMat
)
// Can't fix without duty hacks or broken user code (PR #4159)
TEST
(
Core_Mat_vector
,
DISABLED_OutputArray_create_getMat
)
{
cv
::
Mat_
<
uchar
>
src_base
(
5
,
1
);
std
::
vector
<
uchar
>
dst8
;
...
...
@@ -1347,6 +1348,7 @@ TEST(Core_Mat_vector, copyTo_roi_column)
Mat
src_full
(
src_base
);
Mat
src
(
src_full
.
col
(
0
));
#if 0 // Can't fix without duty hacks or broken user code (PR #4159)
OutputArray _dst(dst1);
{
_dst.create(src.rows, src.cols, src.type());
...
...
@@ -1355,6 +1357,7 @@ TEST(Core_Mat_vector, copyTo_roi_column)
EXPECT_EQ(src.cols, dst.cols);
EXPECT_EQ(src.rows, dst.rows);
}
#endif
std
::
vector
<
uchar
>
dst2
;
src
.
copyTo
(
dst2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment