mirror of
https://github.com/revanced/smali.git
synced 2025-05-05 00:54:25 +02:00
MemoryDataStore: Handle weird arguments values correctly
Namely: - Negative arguments to InputStream::skip(n). - Large arguments to readAt(offset).
This commit is contained in:
parent
c645b9d546
commit
b9a725e726
@ -105,13 +105,13 @@ public class MemoryDataStore implements DexDataStore {
|
||||
}
|
||||
|
||||
@Override public long skip(long n) throws IOException {
|
||||
int skipLength = (int)Math.min(n, size - position);
|
||||
int skipLength = (int)Math.max(0, Math.min(n, size - position));
|
||||
position += skipLength;
|
||||
return skipLength;
|
||||
}
|
||||
|
||||
@Override public int available() throws IOException {
|
||||
return size - position;
|
||||
return Math.max(0, size - position);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user