Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix integer overflow for p.x when step is large #14327

Closed
wants to merge 1 commit into from

Conversation

tomforge
Copy link

resolves #14326

This pullrequest changes

Add a cast to long for integer arithmetric that may potentially overflow in function pos() of cv::LineIterator

Copy link
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Perhaps "won't fix" without appropriate tests (which would be checked on all "supported" platforms).

Other drawing functions still don't support drawing outside of 4k region.

@@ -4903,7 +4903,7 @@ Point LineIterator::pos() const
{
Point p;
p.y = (int)((ptr - ptr0)/step);
p.x = (int)(((ptr - ptr0) - p.y*step)/elemSize);
p.x = (int)(((ptr - ptr0) - (long)p.y*step)/elemSize);
Copy link
Member

Choose a reason for hiding this comment

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

long is still 32-bit on Win32.

Consider using int64 here (or long long int).

@asmorkalov
Copy link
Contributor

@tomforge Do you have any progress on that?

@tomforge
Copy link
Author

@asmorkalov No. I haven't been able to find time to do any extensive testing. Maybe we should close this first?

@asmorkalov asmorkalov closed this Nov 6, 2019
@tomforge tomforge deleted the lineIterator_overflow_fix branch November 7, 2019 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants