[Libreoffice-commits] core.git: vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Feb 12 16:34:57 UTC 2019
vcl/source/gdi/pdfwriter_impl.cxx | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
New commits:
commit aa31976c2e4399a86bc6f70f140972d9ccef6fc0
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Feb 12 15:13:33 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Feb 12 17:34:30 2019 +0100
Resolves: tdf#123298 resize before writing to vector
Change-Id: I8fc25d254781b31e4ffafcf4397a95d79e042cd8
Reviewed-on: https://gerrit.libreoffice.org/67736
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index fdfc4cdabade..ada2cd648646 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1983,7 +1983,8 @@ inline void PDFWriterImpl::appendUnicodeTextStringEncrypt( const OUString& rInSt
//prepare a unicode string, encrypt it
enableStringEncryption( nInObjectNumber );
sal_uInt8 *pCopy = m_vEncryptionBuffer.data();
- sal_Int32 nChars = 2;
+ sal_Int32 nChars = 2 + (nLen * 2);
+ m_vEncryptionBuffer.resize(nChars);
*pCopy++ = 0xFE;
*pCopy++ = 0xFF;
// we need to prepare a byte stream from the unicode string buffer
@@ -1992,10 +1993,8 @@ inline void PDFWriterImpl::appendUnicodeTextStringEncrypt( const OUString& rInSt
sal_Unicode aUnChar = pStr[i];
*pCopy++ = static_cast<sal_uInt8>( aUnChar >> 8 );
*pCopy++ = static_cast<sal_uInt8>( aUnChar & 255 );
- nChars += 2;
}
//encrypt in place
- m_vEncryptionBuffer.resize(nChars);
rtl_cipher_encodeARCFOUR( m_aCipher, m_vEncryptionBuffer.data(), nChars, m_vEncryptionBuffer.data(), nChars );
//now append, hexadecimal (appendHex), the encrypted result
for(int i = 0; i < nChars; i++)
More information about the Libreoffice-commits
mailing list