Skip to content

Commit f3efebf

Browse files
committed
added recoverable throwing of ShortBufferException
1 parent 177d862 commit f3efebf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

prov/src/main/java/org/bouncycastle/jcajce/provider/symmetric/util/BaseStreamCipher.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,16 @@ protected int engineUpdate(
338338
int outputOffset)
339339
throws ShortBufferException
340340
{
341+
if (outputOffset + inputLen > output.length)
342+
{
343+
throw new ShortBufferException("output buffer too short for input.");
344+
}
345+
341346
try
342347
{
343-
cipher.processBytes(input, inputOffset, inputLen, output, outputOffset);
348+
cipher.processBytes(input, inputOffset, inputLen, output, outputOffset);
344349

345-
return inputLen;
350+
return inputLen;
346351
}
347352
catch (DataLengthException e)
348353
{

0 commit comments

Comments
 (0)