Check that we don't read past the end of an object.
@@ -302,6 +302,9 @@ func (rr *randomReader) startRead(
end = start + randomReadSize
}
}
+ if end > int64(rr.object.Size) {
+ end = int64(rr.object.Size)
+ }
// Begin the read.
ctx, cancel := context.WithCancel(context.Background())
