mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-10-15 23:47:39 +00:00
fix integer overflows
* available() method in ChunkFileInputStream.java * free "ahead space" calculation in CircularFileWriter.java
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user