Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@asmorkalov
Copy link
Contributor

@asmorkalov asmorkalov commented Jun 7, 2024

Fixes #25259

The reproducer in the ticket is not valid. It uses non-convex inputs. The PR fixes uncontrolled buffer overflow to prevent crashes.

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

@asmorkalov asmorkalov added this to the 4.11.0 milestone Jun 7, 2024
@asmorkalov asmorkalov requested review from dkurt and mshabunin June 7, 2024 09:42
@asmorkalov asmorkalov force-pushed the as/intersectConvexConvex_fix branch 2 times, most recently from f7fceab to 1e81f0b Compare June 10, 2024 08:03
@asmorkalov asmorkalov marked this pull request as draft June 10, 2024 08:53
@asmorkalov asmorkalov force-pushed the as/intersectConvexConvex_fix branch from 1e81f0b to b9cfd09 Compare June 10, 2024 09:47
@asmorkalov asmorkalov force-pushed the as/intersectConvexConvex_fix branch from b9cfd09 to 6623c62 Compare June 10, 2024 16:38
@asmorkalov asmorkalov marked this pull request as ready for review June 10, 2024 18:04
@asmorkalov asmorkalov requested a review from vpisarev June 11, 2024 09:06
@asmorkalov
Copy link
Contributor Author

@mshabunin @opencv-alalek any comment it this?

std::vector<cv::Point> intersection;

float area = cv::intersectConvexConvex(convex1, convex2, intersection, false);
EXPECT_TRUE(intersection.empty());
Copy link
Contributor

Choose a reason for hiding this comment

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

What if intersection was non-empty before function call, will it be empty afterwards? Maybe we could check it here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The function calls cv::OutputArray::release() for the "error" case, so it's always empty after the test call.

Copy link
Contributor

@mshabunin mshabunin left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just one minor comment/suggestion for the test.

@asmorkalov asmorkalov merged commit 0a12c7d into opencv:4.x Jun 16, 2024
@asmorkalov asmorkalov mentioned this pull request Jul 1, 2024
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.

crash when invoke cv2.intersectConvexConvex

2 participants