guava icon indicating copy to clipboard operation
guava copied to clipboard

Fixed double slicing ByteSource

Open Maxi17 opened this issue 6 years ago • 3 comments

Fixes #3501

However, there is still a problem in this method. If this.offset + this.length > Long.MAX_VALUE, it will overflow. These are 4 possible approaches:

  1. Leave is as it is.
  2. Disallow offset + length > Long.MAX_VALUE on slices by adding checks.
  3. Allow offsets larger than Long.MAX_VALUE.
  4. Assume that no ByteSource has that much elements, and if the offset would overflow, return an empty source.

Maxi17 avatar Jun 12 '19 15:06 Maxi17

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

googlebot avatar Jun 12 '19 15:06 googlebot

I signed it!

Maxi17 avatar Jun 12 '19 15:06 Maxi17

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

googlebot avatar Jun 12 '19 15:06 googlebot

Somehow we ended up merging https://github.com/google/guava/pull/3829 instead of this one. Sorry about that.

cpovirk avatar Jun 26 '23 12:06 cpovirk