summaryrefslogtreecommitdiff
path: root/build.sbt
diff options
context:
space:
mode:
authorRui Gonçalves <ruippeixotog@gmail.com>2015-12-06 19:25:00 +0000
committerRui Gonçalves <ruippeixotog@gmail.com>2015-12-06 19:25:00 +0000
commitc17b18e173e07f421f9171272d94d84908526609 (patch)
tree3008e9e5be2acc44a6ffc7e56e84fe91fbcb0cb8 /build.sbt
parent5e99f82159842c5e2b60a1427e129b0b720a0d38 (diff)
downloadscala-c17b18e173e07f421f9171272d94d84908526609.tar.gz
scala-c17b18e173e07f421f9171272d94d84908526609.tar.bz2
scala-c17b18e173e07f421f9171272d94d84908526609.zip
SI-9581 Fix overflow on Vector take and drop methods
Fixes the index/length comparison in `Vector#take` and `Vector#drop` so that they handle all possible integer values. Given the collection's invariants `startIndex >= endIndex` and `0 >= startIndex, endIndex`, it is sufficient to change the arithmetic in the comparison as done in this commit to avoid overflows. As cases when `n <= 0` are handled beforehand, `endIndex - n` cannot overflow, contrary to `startIndex + n`. If without the danger of overflows the condition yields true, on the other hand, `startIndex + n` cannot overflow as it is smaller than `endIndex` (as the previous formulation of the condition shows).
Diffstat (limited to 'build.sbt')
0 files changed, 0 insertions, 0 deletions