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

Avoid an integer (long) overflow in FindAndDeliverResources. #16972

merged 1 commit into from Aug 23, 2019


Copy link

commented Aug 22, 2019

Fixes #16968.

bSq and cSq were already squared, and multiplying them together meant that we were taking world offsets (which typically have values in the tens of k) to the fourth power - enough to overflow even a long. Taking the square root before multiplying avoids the problem, and rewriting the code in terms of .Length and .LengthSquared makes it more readable.

@pchote pchote added this to the Next Release milestone Aug 22, 2019

@abcdefg30 abcdefg30 merged commit 4db3da6 into OpenRA:bleed Aug 23, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed

This comment has been minimized.

Copy link

commented Aug 23, 2019

@pchote pchote deleted the pchote:fix-harvester-overflow branch Aug 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.