From adfa3c1b106f9e3939495774909c503ed22b3243 Mon Sep 17 00:00:00 2001 From: Simeon Morgan Date: Tue, 12 Nov 2013 13:37:57 +1100 Subject: [PATCH] Optimised use of buffers when decrypting to avoid unnecessary array copying properly. --- .../securesms/crypto/DecryptingPartInputStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/crypto/DecryptingPartInputStream.java b/src/org/thoughtcrime/securesms/crypto/DecryptingPartInputStream.java index 55549a298b..a8fc15c552 100644 --- a/src/org/thoughtcrime/securesms/crypto/DecryptingPartInputStream.java +++ b/src/org/thoughtcrime/securesms/crypto/DecryptingPartInputStream.java @@ -157,7 +157,7 @@ public class DecryptingPartInputStream extends FileInputStream { //data retrieved using cipher.update doesn't always match cipher.getOutputSize (but should never be larger) int outputLen = cipher.getOutputSize(read); - if (outputLen < length) { + if (outputLen <= length) { readLength += cipher.update(internalBuffer, 0, read, buffer, offset); return readLength; }