opencv_contrib: wechat_qrcode exception

System information (version)
  • OpenCV => 4.2
  • Operating System / Platform => Ubuntu16.04
  • Compiler => g++
Detailed description

qrcode decode image get a Segmentation Fault received signal SIGSEGV, Segmentation fault. (double free or corruption (out)) #0 0x00005555555949db in zxing::UnicomBlock::Bfs(int, int) () #1 0x0000555555594b09 in zxing::UnicomBlock::GetUnicomBlockIndex(int, int) () #2 0x00005555555b684f in zxing::qrcode::FinderPatternFinder::find(zxing::DecodeHints const&, zxing::ErrorHandler&) () #3 0x00005555555a1fd3 in zxing::qrcode::Detector::detect(zxing::DecodeHints const&, zxing::ErrorHandler&) () #4 0x00005555555ba32d in zxing::qrcode::QRCodeReader::decodeMore(zxing::Refzxing::BinaryBitmap, zxing::Refzxing::BitMatrix, zxing::DecodeHints, zxing::ErrorHandler&) () #5 0x00005555555bc7a1 in zxing::qrcode::QRCodeReader::decode(zxing::Refzxing::BinaryBitmap, zxing::DecodeHints) () #6 0x00005555555797e4 in cv::wechat_qrcode::DecoderMgr::Decode(zxing::Refzxing::BinaryBitmap, zxing::DecodeHints) () #7 0x0000555555579984 in cv::wechat_qrcode::DecoderMgr::TryDecode(zxing::Refzxing::LuminanceSource, zxing::Refzxing::Result&) () #8 0x0000555555579e37 in cv::wechat_qrcode::DecoderMgr::decodeImage(cv::Mat, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) ()

Steps to reproduce
Issue submission checklist
  • I report the issue, it’s not a question
  • I checked the problem with documentation, FAQ, open issues, answers.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 25 (17 by maintainers)

Most upvoted comments

@dddzg When the hand is covered, there are too many unicomblock, which resulting in a large m_iNowIdx, but the data type is unsigned short, make data overflow to zero.

https://github.com/opencv/opencv_contrib/blob/8eec886808b1352cdb746772ef6e001ff83d2774/modules/wechat_qrcode/src/zxing/common/unicomblock.hpp#L35

and it will fall into an infinite loop: https://github.com/opencv/opencv_contrib/blob/8eec886808b1352cdb746772ef6e001ff83d2774/modules/wechat_qrcode/src/zxing/common/unicomblock.cpp#L103