[Libreoffice-commits] core.git: Branch 'libreoffice-6-2-1' - vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Feb 18 21:14:46 UTC 2019
vcl/source/gdi/pdfwriter_impl.cxx | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
New commits:
commit 9371b1cee88962ac632ed86968915d95a4625b2e
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: Mon Feb 18 22:14:23 2019 +0100
Resolves: tdf#123298 resize before writing to vector
Change-Id: I8fc25d254781b31e4ffafcf4397a95d79e042cd8
Reviewed-on: https://gerrit.libreoffice.org/67738
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
(cherry picked from commit c9e1a5e8894dac6c5f1044dd0e98bc2d453fa995)
Reviewed-on: https://gerrit.libreoffice.org/67766
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
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 e23bfdfb0ef9..ed542157340b 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1990,7 +1990,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
@@ -1999,10 +2000,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