Skip to content

Make sure to not access outside normDiffTab#27321

Merged
asmorkalov merged 2 commits intoopencv:4.xfrom
vrabaud:norm
May 17, 2025
Merged

Make sure to not access outside normDiffTab#27321
asmorkalov merged 2 commits intoopencv:4.xfrom
vrabaud:norm

Conversation

@vrabaud
Copy link
Copy Markdown
Contributor

@vrabaud vrabaud commented May 16, 2025

If the norm is outside the array (e.g. Hamming), memory is read outside of the array, which does not matter because the invalid pointer is not used oustide of the function (e.g. the Hamming path is taken) but it triggers the sanitizer.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@vrabaud vrabaud added this to the 4.12.0 milestone May 16, 2025
@vrabaud vrabaud requested a review from asmorkalov May 16, 2025 08:35
@vrabaud vrabaud added the bug label May 16, 2025
@asmorkalov asmorkalov self-assigned this May 16, 2025
@asmorkalov
Copy link
Copy Markdown
Contributor

There are failures on ARM:

[ RUN      ] Objdetect_QRCode_detect.detect_regression_21287
Exception message: OpenCV(4.12.0-dev) /Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/opencv/modules/core/src/norm.dispatch.cpp:574: error: (-215:Assertion failed) func != 0 in function 'norm'

/Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/opencv/modules/objdetect/test/test_qrcode.cpp:491: Failure
Expected: qrcode.decode(src, corners, straight_barcode) doesn't throw an exception.
  Actual: it throws.
[  FAILED  ] Objdetect_QRCode_detect.detect_regression_21287 (12 ms)

@asmorkalov asmorkalov self-requested a review May 16, 2025 09:44
@asmorkalov asmorkalov merged commit 9201ca1 into opencv:4.x May 17, 2025
28 checks passed
@vrabaud vrabaud deleted the norm branch May 20, 2025 07:39
@asmorkalov asmorkalov mentioned this pull request May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants