Skip to content

Fixed possible out-of-bound access in circles drawing#23931

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
asmorkalov:as/drawing_overflow
Jul 21, 2023
Merged

Fixed possible out-of-bound access in circles drawing#23931
asmorkalov merged 1 commit intoopencv:4.xfrom
asmorkalov:as/drawing_overflow

Conversation

@asmorkalov
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov commented Jul 5, 2023

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

}

if( (unsigned)y12 < (unsigned)size.height )
if( y12 >= 0 && y12 < size.height )
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though standard C++ promotion happens, y12 and size.height have different types so the compiler might complain. Casting to (int64_t) will it should be fine with our CI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it compares "int64_t < int" Both has sign and the comparison is always possible. I do not see any issues with the existing solution.

@vrabaud
Copy link
Copy Markdown
Contributor

vrabaud commented Jul 5, 2023

LGTM

@asmorkalov asmorkalov force-pushed the as/drawing_overflow branch from 6a7ac8d to 52d9685 Compare July 14, 2023 06:23
@asmorkalov
Copy link
Copy Markdown
Contributor Author

asmorkalov commented Jul 19, 2023

@vrabaud @opencv-alalek friendly reminder.

@vrabaud
Copy link
Copy Markdown
Contributor

vrabaud commented Jul 20, 2023

👍

@asmorkalov asmorkalov merged commit 09d2f4e into opencv:4.x Jul 21, 2023
@asmorkalov asmorkalov added this to the 4.9.0 milestone Jul 21, 2023
@asmorkalov asmorkalov mentioned this pull request Jul 27, 2023
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.

3 participants