fixed out of bound error

This commit is contained in:
Walter Oggioni
2020-05-02 00:31:12 +01:00
parent da433c9d14
commit c5d2ba03fa

View File

@@ -98,7 +98,7 @@ public class ZstdInputStream extends InputStream {
break; break;
} else fill(); } else fill();
} }
int toBeRead = Math.min(len, output.pos.intValue() - output.dst.position()); int toBeRead = Math.min(len - totalRead, output.pos.intValue() - output.dst.position());
output.dst.get(arr, off + totalRead, toBeRead); output.dst.get(arr, off + totalRead, toBeRead);
totalRead += toBeRead; totalRead += toBeRead;
} }