Skip to content

Commit

Permalink
Fix integer overflow in SortedRanges.subRangeByPos. Fixes deephaven#664
Browse files Browse the repository at this point in the history
… (deephaven#665)

Co-authored-by: Cristian Ferretti <[email protected]>
  • Loading branch information
2 people authored and jmao-denver committed Nov 23, 2021
1 parent 09f053e commit fab8ce0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ public final SortedRanges subRangesByPos(final long startPosIn, final long endPo
// We don't want to do two passes, we allocated an array big enough instead.
final boolean brokenInitialRange = startPos < pos;
int ansLen = count - i + (brokenInitialRange ? 2 : 1);
ansLen = Math.min(ansLen, (int) (inputRangeSpan + 1));
ansLen = (int) Math.min(ansLen, (inputRangeSpan + 1));
final SortedRanges ans = makeMyTypeAndOffset(ansLen);
ans.count = 0;
ans.cardinality = 0;
Expand Down

0 comments on commit fab8ce0

Please sign in to comment.