mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-27 02:07:42 +00:00
Fix for ShortBufferException problem introduced in Android 4.3
Not really sure how it's possible for the system to give us an extra block of data, but it does if both the input and output buffers are sized the same during the first decrypt. This fixes things, but I wish I better understood why it was broken.
This commit is contained in:
parent
4722b7f005
commit
8281ef18d4
@ -126,7 +126,7 @@ public class DecryptingPartInputStream extends FileInputStream {
|
|||||||
length = (int)(totalDataSize - totalRead);
|
length = (int)(totalDataSize - totalRead);
|
||||||
|
|
||||||
byte[] internalBuffer = new byte[length];
|
byte[] internalBuffer = new byte[length];
|
||||||
int read = super.read(internalBuffer, 0, internalBuffer.length);
|
int read = super.read(internalBuffer, 0, internalBuffer.length <= cipher.getBlockSize() ? internalBuffer.length : internalBuffer.length - cipher.getBlockSize());
|
||||||
totalRead += read;
|
totalRead += read;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user