Skip to content

Commit b4e3d29

Browse files
committed
Updated BlobReadChannel to prevent integer overflow when reading large blobs
1 parent 1118c0e commit b4e3d29

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobReadChannel.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class BlobReadChannel implements ReadChannel {
4545
private final BlobId blob;
4646
private final Map<StorageRpc.Option, ?> requestOptions;
4747
private String lastEtag;
48-
private int position;
48+
private long position;
4949
private boolean isOpen;
5050
private boolean endOfStream;
5151
private int chunkSize = DEFAULT_CHUNK_SIZE;
@@ -164,7 +164,7 @@ static class StateImpl implements RestorableState<ReadChannel>, Serializable {
164164
private final BlobId blob;
165165
private final Map<StorageRpc.Option, ?> requestOptions;
166166
private final String lastEtag;
167-
private final int position;
167+
private final long position;
168168
private final boolean isOpen;
169169
private final boolean endOfStream;
170170
private final int chunkSize;
@@ -185,7 +185,7 @@ static class Builder {
185185
private final BlobId blob;
186186
private final Map<StorageRpc.Option, ?> requestOptions;
187187
private String lastEtag;
188-
private int position;
188+
private long position;
189189
private boolean isOpen;
190190
private boolean endOfStream;
191191
private int chunkSize;
@@ -201,7 +201,7 @@ Builder lastEtag(String lastEtag) {
201201
return this;
202202
}
203203

204-
Builder position(int position) {
204+
Builder position(long position) {
205205
this.position = position;
206206
return this;
207207
}

0 commit comments

Comments
 (0)