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.
fork-5.53.8
Moxie Marlinspike 2013-08-10 09:09:00 -07:00
rodzic 4722b7f005
commit 8281ef18d4
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -126,7 +126,7 @@ public class DecryptingPartInputStream extends FileInputStream {
length = (int)(totalDataSize - totalRead);
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;
try {