jtk
jtk copied to clipboard
Fix index overflow in quickPartition methods.
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 Report
Merging #17 (38bcf61) into master (d8ec668) will decrease coverage by
0.00%. The diff coverage is16.66%.
@@ 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 dataPowered by Codecov. Last update d8ec668...38bcf61. Read the comment docs.