# HG changeset patch # User Thomas Dixon # Date 1221211243 14400 # Node ID 7ea528b618029065ff5f15ffe7344ad5959c8583 # Parent 8c7f8fecdd754f12cd075aa15a898f3e2b9d2948 Fixed two errors in ManagedBlockCipher where inputs equal to the block size of the cipher would cause a bounds error and incorrect output of finishOutputSize respectively. diff -r 8c7f8fecdd75 -r 7ea528b61802 dcrypt/crypto/ManagedBlockCipher.d --- a/dcrypt/crypto/ManagedBlockCipher.d Sat Aug 30 14:38:23 2008 -0400 +++ b/dcrypt/crypto/ManagedBlockCipher.d Fri Sep 12 05:20:43 2008 -0400 @@ -86,7 +86,7 @@ len = input.length, diff = buffer.length - index, i = 0; - if (len > diff) { + if (len >= diff) { buffer[index..buffer.length] = input[i..diff]; result += cipher.update(buffer, output[i..i+blockSize]); index = 0; @@ -181,7 +181,7 @@ // Input is a multiple of block size if (!diff) - return result; + return ((padding is null) ? result : result+blockSize); // No padding, return result if stream mode, 0 if not (it'll error) if (padding is null)