Proper Usage of Memcpy - Security Issue [closed]

asked 2018-03-07 04:42:35 -0600

I need some help in proper usage of the following line

CvMat(const CvMat& m) { memcpy(this, &m, sizeof(CvMat));}

Is it correct to update the memcpy_s instead of memcpy

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by berak
close date 2018-03-07 05:43:19.313135

Comments

no, this is entirely incorrect. CvMat is a composite (non POD) object, you cannot simply memcpy it.

but: the whole C-api is deprecated, and was abandoned already in 2010, (given your issue above, you may understand, why)

YOU MUST NOT USE ANY OF THIS

please use the c++ api, cv::Mat instead

please have a look at opencv's tutorials, you may have to re-learn all of it

berak gravatar imageberak ( 2018-03-07 05:42:57 -0600 )edit