From c078e432903bfdcabed6ae86d585aeae82716cd1 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 21 Oct 2018 07:01:53 +0200 Subject: tdf#120703 (PVS): 920d4463f6e59b815852c173e2974ffc7b4bb284 follow-up V519 The 'o_rKeyLength' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1276, 1279. V519 The 'o_rRC4KeyLength' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1277, 1280. Change-Id: I1dc4ba9097996201d97ef323113ed0b11f3cb913 Reviewed-on: https://gerrit.libreoffice.org/62120 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- vcl/source/gdi/pdfwriter_impl2.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 1cd4f81993c5..1572248e8263 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1253,17 +1253,14 @@ sal_Int32 PDFWriterImpl::computeAccessPermissions( const vcl::PDFWriter::PDFEncr according to the table 3.15, pdf v 1.4 */ sal_Int32 nAccessPermissions = 0xfffff0c0; - /* check permissions for 40 bit security case */ + o_rKeyLength = SECUR_128BIT_KEY; + o_rRC4KeyLength = 16; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 16, + // thus maximum permitted value is 16 + nAccessPermissions |= ( i_rProperties.CanPrintTheDocument ) ? 1 << 2 : 0; nAccessPermissions |= ( i_rProperties.CanModifyTheContent ) ? 1 << 3 : 0; nAccessPermissions |= ( i_rProperties.CanCopyOrExtract ) ? 1 << 4 : 0; nAccessPermissions |= ( i_rProperties.CanAddOrModify ) ? 1 << 5 : 0; - o_rKeyLength = SECUR_40BIT_KEY; - o_rRC4KeyLength = SECUR_40BIT_KEY+5; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 5 - - o_rKeyLength = SECUR_128BIT_KEY; - o_rRC4KeyLength = 16; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 16, thus maximum - // permitted value is 16 nAccessPermissions |= ( i_rProperties.CanFillInteractive ) ? 1 << 8 : 0; nAccessPermissions |= ( i_rProperties.CanExtractForAccessibility ) ? 1 << 9 : 0; nAccessPermissions |= ( i_rProperties.CanAssemble ) ? 1 << 10 : 0; -- cgit v1.2.3