mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-16 05:41:30 +01:00
fix integer overflows
* available() method in ChunkFileInputStream.java * free "ahead space" calculation in CircularFileWriter.java
This commit is contained in:
parent
96086b7733
commit
62d934dd8e
@ -104,7 +104,7 @@ public class ChunkFileInputStream extends SharpStream {
|
||||
|
||||
@Override
|
||||
public long available() {
|
||||
return (int) (length - position);
|
||||
return length - position;
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyCatchBlock")
|
||||
|
@ -221,7 +221,7 @@ public class CircularFileWriter extends SharpStream {
|
||||
available = out.length - offsetOut;
|
||||
}
|
||||
|
||||
int length = Math.min(len, (int) available);
|
||||
int length = Math.min(len, (int) Math.min(Integer.MAX_VALUE, available));
|
||||
out.write(b, off, length);
|
||||
|
||||
len -= length;
|
||||
|
Loading…
Reference in New Issue
Block a user