Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hook <dgh@cryptoworkshop.com>2014-03-03 00:50:08 +0400
committerDavid Hook <dgh@cryptoworkshop.com>2014-03-03 00:50:08 +0400
commit933119114c96f703d1303a3c77d9ac405091270d (patch)
tree23d488136b093f75c590a8ec72baef803c69e39d /core/src/main/java/org
parent1fa421e15b9d4223aae7e0296aeb34961caaeedd (diff)
fixed buffer underflow
Diffstat (limited to 'core/src/main/java/org')
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/io/CipherInputStream.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/io/CipherInputStream.java b/core/src/main/java/org/bouncycastle/crypto/io/CipherInputStream.java
index 93b04e99..66772df5 100644
--- a/core/src/main/java/org/bouncycastle/crypto/io/CipherInputStream.java
+++ b/core/src/main/java/org/bouncycastle/crypto/io/CipherInputStream.java
@@ -46,7 +46,9 @@ public class CipherInputStream
this.bufferedBlockCipher = cipher;
- buf = new byte[cipher.getOutputSize(INPUT_BUF_SIZE)];
+ int outSize = cipher.getOutputSize(INPUT_BUF_SIZE);
+
+ buf = new byte[(outSize > INPUT_BUF_SIZE) ? outSize : INPUT_BUF_SIZE];
inBuf = new byte[INPUT_BUF_SIZE];
}
@@ -71,7 +73,9 @@ public class CipherInputStream
this.aeadBlockCipher = cipher;
- buf = new byte[cipher.getOutputSize(INPUT_BUF_SIZE)];
+ int outSize = cipher.getOutputSize(INPUT_BUF_SIZE);
+
+ buf = new byte[(outSize > INPUT_BUF_SIZE) ? outSize : INPUT_BUF_SIZE];
inBuf = new byte[INPUT_BUF_SIZE];
}