rgbd(linemod): fix segfault in unaligned memory access - #4180
Open
omarwael-24 wants to merge 6 commits into
Open
rgbd(linemod): fix segfault in unaligned memory access#4180omarwael-24 wants to merge 6 commits into
omarwael-24 wants to merge 6 commits into
Conversation
…perations orUnaligned8u crashed with SIGSEGV when image stride was not 16-byte aligned. The previous code used aligned dereferencing on dst pointers and checked src alignment only once before the row loop. This replaces raw SSE intrinsics with OpenCV universal intrinsics. It ensures safe unaligned loads and stores for both src and dst across all rows. Fixes #29559
…perations orUnaligned8u crashed with SIGSEGV when image stride was not 16-byte aligned. The previous code used aligned dereferencing on dst pointers and checked src alignment only once before the row loop. This replaces raw SSE intrinsics with OpenCV universal intrinsics. It ensures safe unaligned loads and stores for both src and dst across all rows. Create a test file for linemod.cpp Fixes #29559
Fix SIGSEGV in orUnaligned8u caused by unsafe memory alignment assumptions. Replaced raw pointer casting with OpenCV universal intrinsics (vx_load, vx_store, v_or) to safely support non-16-byte aligned buffers across architectures. Added a unit test to verify stability with unaligned inputs.
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.
Bug Description
Calling
linemod::matchwith unaligned memory buffers (such as sub-matrices generated viacv::Rectoffsets) caused aSIGSEGVcrash insideorUnaligned8u.The issue stemmed from raw pointer casting that assumed strict memory alignment constraints.
Fix Details
orUnaligned8uwith OpenCV Universal Intrinsics (vx_load,vx_store, andv_or).RGBD_Linemod.MatchUnaligned) to verify stability when executing matches on unaligned inputs.Testing
Ran the standalone test target:
./bin/opencv_test_rgbd --gtest_filter=*MatchUnaligned*Result:
[ PASSED ] 1 test.