Skip to content
Permalink
Browse files

fixed buffer underflow

  • Loading branch information
dghgit committed Mar 2, 2014
1 parent 1fa421e commit 933119114c96f703d1303a3c77d9ac405091270d
Showing with 6 additions and 2 deletions.
  1. +6 −2 core/src/main/java/org/bouncycastle/crypto/io/CipherInputStream.java
@@ -46,7 +46,9 @@ public 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 CipherInputStream(InputStream is, AEADBlockCipher cipher)

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];
}

0 comments on commit 9331191

Please sign in to comment.
You can’t perform that action at this time.