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 index overflow in quickPartition methods. #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bkmacy
Copy link

@bkmacy bkmacy commented Feb 24, 2021

When sorting a large array where the length is more than half the maximum integer value, one of the computed indices in quickPartition may overflow, which can lead to a negative array index. This patch fixes the overflow issue using longs to compute the index value.

@codecov
Copy link

codecov bot commented Feb 24, 2021

Codecov Report

Merging #17 (38bcf61) into master (d8ec668) will decrease coverage by 0.00%.
The diff coverage is 16.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #17      +/-   ##
============================================
- Coverage     40.85%   40.84%   -0.01%     
- Complexity     7221     7222       +1     
============================================
  Files           264      264              
  Lines         63167    63167              
  Branches      10299    10299              
============================================
- Hits          25809    25803       -6     
- Misses        35659    35663       +4     
- Partials       1699     1701       +2     
Impacted Files Coverage Δ Complexity Δ
...re/src/main/java/edu/mines/jtk/util/ArrayMath.java 59.11% <16.66%> (ø) 1667.00 <0.00> (ø)
core/src/main/java/edu/mines/jtk/util/RTree.java 77.25% <0.00%> (-0.35%) 30.00% <0.00%> (ø%)
core/src/main/java/edu/mines/jtk/mesh/TriMesh.java 60.83% <0.00%> (-0.23%) 243.00% <0.00%> (-1.00%)
core/src/main/java/edu/mines/jtk/mesh/TetMesh.java 51.43% <0.00%> (ø) 388.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8ec668...38bcf61. Read the comment docs.

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

1 participant