aruco: fix SIGSEGV in detectMarkers on ARM/Raspberry Pi (issue #3938)#4102
Open
Utkarshkhandka wants to merge 1 commit intoopencv:4.xfrom
Open
aruco: fix SIGSEGV in detectMarkers on ARM/Raspberry Pi (issue #3938)#4102Utkarshkhandka wants to merge 1 commit intoopencv:4.xfrom
Utkarshkhandka wants to merge 1 commit intoopencv:4.xfrom
Conversation
…#3938) On ARM/aarch64 (Raspberry Pi 5, Bookworm, OpenCV 4.6.0), calling detectMarkers() with the new API causes SIGSEGV at address 0x60. Root cause: makePtr<DetectorParameters>() used as a default argument in the header is evaluated at the call-site on ARM. The Ptr<> object is not fully constructed before the function dereferences it. Changes: - aruco.hpp: replace makePtr<> default args with Ptr<>() (null), handle null safely in impl with internal fallback construction - aruco.cpp: null guards on all Ptr<> dereferences; try/catch around solvePnP calls; safe fallback for null default args - charuco.cpp: null guards on all Ptr<> dereferences; safe fallback for null dictionary default in detectCharucoDiamond - aruco_calib.cpp: null guards on board; changed CV_Assert on empty frames to continue (valid real-world scenario) - precomp.hpp: fix wrong include guard name (was ccalib, should be aruco) - test_aruco.py: add ARM regression tests for issue opencv#3938 Fixes: opencv#3938
Author
|
Hi @opencv-bot, could you please approve the CI workflow run for this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes SIGSEGV crash in
cv2.aruco.detectMarkers()on ARM/aarch64(Raspberry Pi 5, Bookworm, Python 3.11, OpenCV 4.6.0).
Issue
Closes #3938
Root Cause
makePtr<DetectorParameters>()used as a default argument inaruco.hppis evaluated at the call site on ARM. The
Ptr<>refcount block is notfully ready before the function dereferences it, causing SIGSEGV at 0x60.
The same pattern exists across all legacy wrapper functions.
Fix
makePtr<>()default args in headers to safe nullPtr<>()CV_Assertnull guards before everyPtr<>dereferencetry/catcharoundsolvePnPcalls to prevent unhandled exceptionsprecomp.hpp(ccalib -> aruco)CV_Assertabort on empty frames incalibrateCameraArucotest_aruco.pyTested