Skip to content

Conversation

lbergelson
Copy link
Contributor

Potential fix for https://github.com/broadinstitute/gatk/security/code-scanning/15

To fix the problem, we need to change the type of the total variable from int to long. This will ensure that the sum of the long values in the array is correctly stored without any implicit narrowing conversion. The change should be made in the sum(final long[] x) method in the MathUtils class.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ersion in compound assignment

Fixes a bug where sums were accidentally cast down to int.  Looking at the usages it seems like it's unlikely it was ever a problem in practice because the sums calculated look like they would never have been bigger than max int.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@lbergelson
Copy link
Contributor Author

@jamesemery code scanning found a real bug. It's a miracle!

@lbergelson lbergelson marked this pull request as ready for review April 13, 2025 17:07
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.

1 participant