Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wechat_qrcode crash in zxing detector #3235

Closed
BerylLuo opened this issue Apr 20, 2022 · 2 comments
Closed

wechat_qrcode crash in zxing detector #3235

BerylLuo opened this issue Apr 20, 2022 · 2 comments

Comments

@BerylLuo
Copy link

BerylLuo commented Apr 20, 2022

crash backtrace:
thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x27fc00008)
frame #0: 0x0000000101443870 void std::__1::__sort<zxing::qrcode::(anonymous namespace)::XComparator&, zxing::Ref<zxing::qrcode::FinderPattern>*>(zxing::Ref<zxing::qrcode::FinderPattern>*, zxing::Ref<zxing::qrcode::FinderPattern>*, zxing::qrcode::(anonymous namespace)::XComparator&) + 1808 frame #1: 0x000000010143185c zxing::qrcode::FinderPatternFinder::selectBestPatterns(zxing::ErrorHandler&) + 1544
frame #2: 0x000000010142e1b0 zxing::qrcode::FinderPatternFinder::getPatternInfosFileMode(zxing::DecodeHints const&, zxing::ErrorHandler&) + 492 frame #3: 0x000000010142d398 zxing::qrcode::FinderPatternFinder::find(zxing::DecodeHints const&, zxing::ErrorHandler&) + 1556
frame #4: 0x000000010145fb3c zxing::qrcode::Detector::detect(zxing::DecodeHints const&, zxing::ErrorHandler&) + 220 frame #5: 0x00000001014a8ea8 zxing::qrcode::QRCodeReader::decodeMore(zxing::Refzxing::BinaryBitmap, zxing::Refzxing::BitMatrix, zxing::DecodeHints, zxing::ErrorHandler&) + 408
frame #6: 0x00000001014a8ac8 zxing::qrcode::QRCodeReader::decode(zxing::Ref<zxing::BinaryBitmap>, zxing::DecodeHints) + 520 frame #7: 0x0000000101485fd8 wechat_qrcode::DecoderMgr::TryDecode(zxing::Refzxing::LuminanceSource, zxing::Refzxing::Result&) + 340
frame #8: 0x0000000101485b60 `wechat_qrcode::DecoderMgr::decodeImage(Justice::JTMat&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) + 656

I modified if(!isnan(x)) to if(!isnan(x) && x >= 0.0) in line 1125 and line 1130 to solved this problem.
Just woderiny why isnan() function doesn't work.

@asmorkalov
Copy link
Contributor

Could you provide the image that generates crash and sample code to reproduce the issue?

@BerylLuo
Copy link
Author

Sorry, the source project is too complicated so I can't extract the sample code. The weird thing is that crash appears when decoding images asynchronously, but not when decoding single one image.

Follow the backtrace I try to print a->getX() and b->getX() in line113, both of it is "nan". I guess the reason is isnan() in line 1125 and 1130 doesn't work, so pushed nan coordinate in possibleCenters_ . After I modify the if-condition according to line 1089 and 1116, the crash no longer occurs.

bool operator()(Ref<FinderPattern> a, Ref<FinderPattern> b) { return a->getX() < b->getX(); }

@BerylLuo BerylLuo closed this as completed Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants