commit 043972a4ed66c1a2440151687931815bf5db5874
Author: Francesco Pretto <ceztko@gmail.com>
Date:   Tue Dec 25 20:59:16 2018 +0100

    EncryptTest: Fix buffer overflow in decrypted out buffer in TestEncrypt()
    
    According to OpenSSL 1.1.0 documentation[1], "the decrypted data buffer out passed
    to the EVP_DecryptUpdate() should have sufficient room for (inl + cipher_block_size)
    bytes". In TesEncrypt(), pDecryptedBuffer has the exactly the size of the known clear
    text, which sounds correct but it's currently violating the contract of EVP_DecryptUpdate()
    used in PdfEncryptAESBase::BaseDecrypt() and causing a buffer overflow detected by
    MSVC when running the the test in Debug build . Fix TestEncrypt() so the out data buffer
    will end having exactly inl + cipher_clock_size.
    
    [1] https://www.openssl.org/docs/man1.1.0/crypto/EVP_DecryptUpdate.html

diff --git a/test/unit/EncryptTest.cpp b/test/unit/EncryptTest.cpp
index 6566496..3634fe6 100644
--- a/test/unit/EncryptTest.cpp
+++ b/test/unit/EncryptTest.cpp
@@ -199,7 +199,7 @@ void EncryptTest::TestEncrypt( PdfEncrypt* pEncrypt )
     pdf_long nOutputLen = pEncrypt->CalculateStreamLength(m_lLen);
 
     unsigned char *pEncryptedBuffer = new unsigned char[nOutputLen];
-    unsigned char *pDecryptedBuffer = new unsigned char[m_lLen];
+    unsigned char *pDecryptedBuffer = new unsigned char[nOutputLen];
 
     // Encrypt buffer
     try {
