fix bug : read error when position after 2147483647 (#3829)

Co-authored-by: huang.lin <hh@chaintool.ai>
This commit is contained in:
livehl 2022-10-12 08:50:12 +08:00 committed by GitHub
parent f6c8720ded
commit c34f04b35b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,9 +119,8 @@ public class SeaweedInputStream extends InputStream {
long bytesRead = 0;
int len = buf.remaining();
int start = (int) this.position;
if (start + len <= entry.getContent().size()) {
entry.getContent().substring(start, start + len).copyTo(buf);
if (this.position< Integer.MAX_VALUE && (this.position + len )<= entry.getContent().size()) {
entry.getContent().substring((int)this.position, (int)(this.position + len)).copyTo(buf);
} else {
bytesRead = SeaweedRead.read(this.filerClient, this.visibleIntervalList, this.position, buf, SeaweedRead.fileSize(entry));
}