Skip to content

Fix overlow pointers.#26848

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
vrabaud:png
Jan 27, 2025
Merged

Fix overlow pointers.#26848
asmorkalov merged 1 commit intoopencv:4.xfrom
vrabaud:png

Conversation

@vrabaud
Copy link
Copy Markdown
Contributor

@vrabaud vrabaud commented Jan 27, 2025

step and maskStep are used to increase/decrease pImage. But it's done on unsigned type, relying on overflow, which is UB. (step is size_t but seed.y is int and can be negative, the result is therefore unsigned which can overflow)

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 requested a review from asmorkalov January 27, 2025 08:59
`step` and `maskStep` are used to increase/decrease `pImage`.
But it's done on unsigned type, relying on overflow, which is UB.
(step is size_t but seed.y is int and can be negative, the result
is therefore unsigned which can overflow)
@asmorkalov asmorkalov added this to the 4.12.0 milestone Jan 27, 2025
@asmorkalov asmorkalov self-assigned this Jan 27, 2025
@asmorkalov asmorkalov merged commit f5c06f8 into opencv:4.x Jan 27, 2025
@vrabaud vrabaud deleted the png branch February 10, 2025 15:53
@asmorkalov asmorkalov mentioned this pull request Feb 19, 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