AddressSanitizer: undefined-behavior when run opencv code

asked 2018-06-21 09:57:58 -0600

g00267881 gravatar image

updated 2018-06-21 10:05:46 -0600

this is my code:

int main() { cv::Ptr<cv::feature2d> detector_ptr = FastFeatureDetector::create(4); return 0; }

it seems very simple,but when i compiled it with :

gcc test.cpp -g -fsanitize=undefined -lstdc++ -std=c++11 -o test pkg-config opencv --cflags --libs

then run ./test, it appears this error:

/usr/include/opencv2/core/ptr.inl.hpp:143:29: runtime error: member call on address 0x00000254f820 which does not point to an object of type 'PtrOwner'

0x00000254f820: note: object is of type 'cv::detail::PtrOwnerImpl(cv::FastFeatureDetector_Impl,cv::DefaultDeleter(cv::FastFeatureDetector_Impl))'

00 00 00 00 60 45 0d b1 f6 7f 00 00 01 00 00 00 00 00 00 00 b0 f5 54 02 00 00 00 00 00 00 00 00

vptr for 'cv::detail::PtrOwnerImpl(cv::FastFeatureDetector_Impl, cv::DefaultDeleter(cv::FastFeatureDetector_Impl) )'

the opencv version is 3.3.1

i really don't know what happened,it looks strange; why it's a undefined behavior ?

edit retag flag offensive close merge delete

Comments

which opencv version, exactly ?

berak gravatar imageberak ( 2018-06-21 10:01:19 -0600 )edit

3.3.1 version

g00267881 gravatar imageg00267881 ( 2018-06-21 19:58:50 -0600 )edit