The following commit has been merged in the master branch: commit 1d3a2df4e9608e9674f340964a0daeb9d4da846c Author: Rene Engelhard <r...@debian.org> Date: Thu Aug 2 08:40:04 2012 +0200
remove duplicate patching of files... diff --git a/patches/CVE-2012-2665.diff b/patches/CVE-2012-2665.diff index 9891139..a31b610 100644 --- a/patches/CVE-2012-2665.diff +++ b/patches/CVE-2012-2665.diff @@ -1,32 +1,32 @@ -Date: Fri, 08 Jun 2012 10:23:44 +0100 -From: Caolán McNamara <caol...@redhat.com> -To: Petr Mladek <pmla...@suse.cz> -Cc: tdf-secur...@lists.documentfoundation.org -Subject: [REVIEW 3-5] Re: Is CVE-2012-2665 fixed in LO? - -On Thu, 2012-06-07 at 18:23 +0200, Petr Mladek wrote: -> Hi Caolan, -> -> I am a bit confused by all the security problems. Is CVE-2012-2665 fixed -> in LO-3.5? - -Not yet. I wanted to wait to propose any more backports until the -backlog was cleared to try and avoid confusion :-) - -So, I'm now requesting the following three additional commits to be -cherry-picked to 3-5 - -78f614e5fff70d4874322255cca739f430865f0a key-size -acc613a3236c61c8272bde1eadca5d8bf25f98f1 tag-hierarchy -4a7164429b727bd8fd6f183950e85e6225869364 count-and-order - -to address CVE-2012-2665 - -I'd like to consider those three + the already cherry-picked -4036ee4db7b43cac9f892c2b9a2c545f0f838747 as our canonical solution to -CVE-2012-2665 (78f614e5fff70d4874322255cca739f430865f0a is technically -not really relevant but I reckon its easiest to bundle it into any -backports while we're at it to keep things simple) +Date: Fri, 08 Jun 2012 10:23:44 +0100 +From: Caolán McNamara <caol...@redhat.com> +To: Petr Mladek <pmla...@suse.cz> +Cc: tdf-secur...@lists.documentfoundation.org +Subject: [REVIEW 3-5] Re: Is CVE-2012-2665 fixed in LO? + +On Thu, 2012-06-07 at 18:23 +0200, Petr Mladek wrote: +> Hi Caolan, +> +> I am a bit confused by all the security problems. Is CVE-2012-2665 fixed +> in LO-3.5? + +Not yet. I wanted to wait to propose any more backports until the +backlog was cleared to try and avoid confusion :-) + +So, I'm now requesting the following three additional commits to be +cherry-picked to 3-5 + +78f614e5fff70d4874322255cca739f430865f0a key-size +acc613a3236c61c8272bde1eadca5d8bf25f98f1 tag-hierarchy +4a7164429b727bd8fd6f183950e85e6225869364 count-and-order + +to address CVE-2012-2665 + +I'd like to consider those three + the already cherry-picked +4036ee4db7b43cac9f892c2b9a2c545f0f838747 as our canonical solution to +CVE-2012-2665 (78f614e5fff70d4874322255cca739f430865f0a is technically +not really relevant but I reckon its easiest to bundle it into any +backports while we're at it to keep things simple) C. @@ -37,12 +37,39 @@ Subject: merge three base64 encoders/decoders together Conflicts: - filter/source/placeware/Base64Codec.cxx - package/source/manifest/Base64Codec.cxx + filter/source/placeware/Base64Codec.cxx + package/source/manifest/Base64Codec.cxx Change-Id: Ic123c081fcf6ddcf5d61c5d5a3eab01db470014c Signed-off-by: Miklos Vajna <vmik...@suse.cz> ---- + +From 78f614e5fff70d4874322255cca739f430865f0a Mon Sep 17 00:00:00 2001 +From: Caolán McNamara <caol...@redhat.com> +Date: Mon, 28 May 2012 09:33:40 +0000 +Subject: check key size + +Change-Id: Ia909b0abb3ef84a9f0a14d42379f693ae9e70812 + +From acc613a3236c61c8272bde1eadca5d8bf25f98f1 Mon Sep 17 00:00:00 2001 +From: Caolán McNamara <caol...@redhat.com> +Date: Mon, 28 May 2012 09:35:31 +0000 +Subject: unwind manifest xml parser and follow tag hierarchy model + +so we validate that each tag is inside the right parent + +Change-Id: Ibc82aeaf6b409ef2fed7de0cd8f15c164da65e53 + +From 4a7164429b727bd8fd6f183950e85e6225869364 Mon Sep 17 00:00:00 2001 +From: Caolán McNamara <caol...@redhat.com> +Date: Mon, 28 May 2012 10:43:09 +0000 +Subject: count and order of receipt of properties doesn't matter + +so stick imported properties into assigned slots and throw out empty ones when +finished. Reuse existing ids for this between import and export. Shuffle +FULLPATH to 0 as per import comment + +Change-Id: I516116c5327498ad043f6e2fb9bd257599ade2a2 + diff --git a/filter/Library_placeware.mk b/filter/Library_placeware.mk index d0af3c1..0471cd2 100644 --- a/filter/Library_placeware.mk @@ -61,10 +88,9 @@ index d0af3c1..0471cd2 100644 filter/source/placeware/filter \ filter/source/placeware/tempfile \ diff --git a/filter/source/placeware/Base64Codec.cxx b/filter/source/placeware/Base64Codec.cxx -deleted file mode 100644 -index 49cfcc0..0000000 +index 49cfcc0..e69de29 100644 --- a/filter/source/placeware/Base64Codec.cxx -+++ b/dev/null ++++ b/filter/source/placeware/Base64Codec.cxx @@ -1,206 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* @@ -273,10 +299,9 @@ index 49cfcc0..0000000 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/placeware/Base64Codec.hxx b/filter/source/placeware/Base64Codec.hxx -deleted file mode 100644 -index b635b1e..0000000 +index b635b1e..e69de29 100644 --- a/filter/source/placeware/Base64Codec.hxx -+++ b/dev/null ++++ b/filter/source/placeware/Base64Codec.hxx @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* @@ -375,6 +400,42 @@ index 306887e..dfce64b 100644 package/source/manifest/ManifestExport \ package/source/manifest/ManifestImport \ package/source/manifest/ManifestReader \ +diff --git a/package/inc/PackageConstants.hxx b/package/inc/PackageConstants.hxx +index be82010..7590acd 100644 +--- a/package/inc/PackageConstants.hxx ++++ b/package/inc/PackageConstants.hxx +@@ -40,19 +40,19 @@ const sal_Int32 n_ConstDigestLength = 1024; + const sal_Int32 n_ConstDigestDecrypt = 1056; // 1024 + 32 + + // the constants related to the manifest.xml entries +-#define PKG_MNFST_MEDIATYPE 0 +-#define PKG_MNFST_VERSION 1 +-#define PKG_MNFST_FULLPATH 2 ++#define PKG_MNFST_FULLPATH 0 //FullPath (Put full-path property first for MBA) ++#define PKG_MNFST_VERSION 1 //Version ++#define PKG_MNFST_MEDIATYPE 2 //MediaType + +-#define PKG_MNFST_INIVECTOR 3 +-#define PKG_MNFST_SALT 4 +-#define PKG_MNFST_ITERATION 5 +-#define PKG_MNFST_UCOMPSIZE 6 +-#define PKG_MNFST_DIGEST 7 +-#define PKG_MNFST_ENCALG 8 +-#define PKG_MNFST_STARTALG 9 +-#define PKG_MNFST_DIGESTALG 10 +-#define PKG_MNFST_DERKEYSIZE 11 ++#define PKG_MNFST_INIVECTOR 3 //InitialisationVector ++#define PKG_MNFST_SALT 4 //Salt ++#define PKG_MNFST_ITERATION 5 //IterationCount ++#define PKG_MNFST_UCOMPSIZE 6 //Size ++#define PKG_MNFST_DIGEST 7 //Digest ++#define PKG_MNFST_ENCALG 8 //EncryptionAlgorithm ++#define PKG_MNFST_STARTALG 9 //StartKeyAlgorithm ++#define PKG_MNFST_DIGESTALG 10 //DigestAlgorithm ++#define PKG_MNFST_DERKEYSIZE 11 //DerivedKeySize + + #define PKG_SIZE_NOENCR_MNFST 3 + #define PKG_SIZE_ENCR_MNFST 12 diff --git a/package/prj/build.lst b/package/prj/build.lst index e1a2c11..35b408d 100644 --- a/package/prj/build.lst @@ -384,10 +445,9 @@ index e1a2c11..35b408d 100644 +pk package : cppu cppuhelper comphelper ucbhelper sal ZLIB:zlib LIBXSLT:libxslt sax NULL pk package\prj nmake - all pk_prj NULL diff --git a/package/source/manifest/Base64Codec.cxx b/package/source/manifest/Base64Codec.cxx -deleted file mode 100644 -index 66a7f18..0000000 +index 66a7f18..e69de29 100644 --- a/package/source/manifest/Base64Codec.cxx -+++ b/dev/null ++++ b/package/source/manifest/Base64Codec.cxx @@ -1,204 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* @@ -594,10 +654,9 @@ index 66a7f18..0000000 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/package/source/manifest/Base64Codec.hxx b/package/source/manifest/Base64Codec.hxx -deleted file mode 100644 -index 60bd018..0000000 +index 60bd018..e69de29 100644 --- a/package/source/manifest/Base64Codec.hxx -+++ b/dev/null ++++ b/package/source/manifest/Base64Codec.hxx @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* @@ -688,7 +747,7 @@ index a9e9f45..94e5234 100644 xHandler->ignorableWhitespace ( sWhiteSpace ); diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx -index 01cf6a5..8756081 100644 +index 01cf6a5..0944d8e 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -29,7 +29,7 @@ @@ -700,95 +759,17 @@ index 01cf6a5..8756081 100644 #include <com/sun/star/xml/sax/XAttributeList.hpp> #include <com/sun/star/xml/crypto/DigestID.hpp> #include <com/sun/star/xml/crypto/CipherID.hpp> -@@ -188,7 +188,7 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re - { - aString = aConvertedAttribs[sChecksumAttribute]; - uno::Sequence < sal_Int8 > aDecodeBuffer; -- Base64Codec::decodeBase64( aDecodeBuffer, aString ); -+ ::sax::Converter::decodeBase64(aDecodeBuffer, aString); - aSequence[nNumProperty].Name = sDigestProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; - } -@@ -235,7 +235,7 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re - { - aString = aConvertedAttribs[sInitialisationVectorAttribute]; - uno::Sequence < sal_Int8 > aDecodeBuffer; -- Base64Codec::decodeBase64 ( aDecodeBuffer, aString ); -+ ::sax::Converter::decodeBase64(aDecodeBuffer, aString); - aSequence[nNumProperty].Name = sInitialisationVectorProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; - } -@@ -250,7 +250,7 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re - { - aString = aConvertedAttribs[sSaltAttribute]; - uno::Sequence < sal_Int8 > aDecodeBuffer; -- Base64Codec::decodeBase64 ( aDecodeBuffer, aString ); -+ ::sax::Converter::decodeBase64(aDecodeBuffer, aString); - aSequence[nNumProperty].Name = sSaltProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; +@@ -44,8 +44,7 @@ using ::rtl::OUString; --- -cgit v0.9.0.2-2-gbebe - -From 78f614e5fff70d4874322255cca739f430865f0a Mon Sep 17 00:00:00 2001 -From: Caolán McNamara <caol...@redhat.com> -Date: Mon, 28 May 2012 09:33:40 +0000 -Subject: check key size - -Change-Id: Ia909b0abb3ef84a9f0a14d42379f693ae9e70812 ---- -diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx -index 16d5a00..f154dfe 100644 ---- a/package/source/zipapi/ZipFile.cxx -+++ b/package/source/zipapi/ZipFile.cxx -@@ -157,6 +157,12 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un + // --------------------------------------------------- + ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector ) +-: nNumProperty ( 0 ) +-, bIgnoreEncryptData ( sal_False ) ++: bIgnoreEncryptData ( sal_False ) + , nDerivedKeySize( 0 ) + , rManVector ( rNewManVector ) - try - { -+ if (xEncryptionData->m_nDerivedKeySize < 0) -+ { -+ throw ZipIOException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid derived key length!") ), -+ uno::Reference< XInterface >() ); -+ } -+ - uno::Sequence< sal_Int8 > aDerivedKey( xEncryptionData->m_nDerivedKeySize ); - if ( rtl_Digest_E_None != rtl_digest_PBKDF2( reinterpret_cast< sal_uInt8* >( aDerivedKey.getArray() ), - aDerivedKey.getLength(), -@@ -192,7 +198,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un - uno::Reference< XInterface >() ); - } - } -- catch( uno::Exception& ) -+ catch( ... ) - { - OSL_ENSURE( sal_False, "Can not create cipher context!" ); - } -@@ -699,7 +705,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry ) - || rEntry.nPathLen != nPathLen - || !rEntry.sPath.equals( sLOCPath ); - } -- catch(::std::bad_alloc &) -+ catch(...) - { - bBroken = sal_True; - } --- -cgit v0.9.0.2-2-gbebe - -From acc613a3236c61c8272bde1eadca5d8bf25f98f1 Mon Sep 17 00:00:00 2001 -From: Caolán McNamara <caol...@redhat.com> -Date: Mon, 28 May 2012 09:35:31 +0000 -Subject: unwind manifest xml parser and follow tag hierarchy model - -so we validate that each tag is inside the right parent - -Change-Id: Ibc82aeaf6b409ef2fed7de0cd8f15c164da65e53 ---- -diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx -index 5e9a310..f8590fe 100644 ---- a/package/source/manifest/ManifestImport.cxx -+++ b/package/source/manifest/ManifestImport.cxx -@@ -123,177 +123,229 @@ void SAL_CALL ManifestImport::endDocument( ) +@@ -123,177 +122,235 @@ void SAL_CALL ManifestImport::endDocument( ) { } @@ -800,21 +781,20 @@ index 5e9a310..f8590fe 100644 { - StringHashMap aConvertedAttribs; - ::rtl::OUString aConvertedName = PushNameAndNamespaces( aName, xAttribs, aConvertedAttribs ); -+ aSequence.realloc ( PKG_SIZE_ENCR_MNFST ); ++ aSequence.resize(PKG_SIZE_ENCR_MNFST); - if ( aConvertedName == sFileEntryElement ) -+ // Put full-path property first for MBA -+ aSequence[nNumProperty].Name = sFullPathProperty; -+ aSequence[nNumProperty++].Value <<= rConvertedAttribs[sFullPathAttribute]; -+ aSequence[nNumProperty].Name = sMediaTypeProperty; -+ aSequence[nNumProperty++].Value <<= rConvertedAttribs[sMediaTypeAttribute]; ++ aSequence[PKG_MNFST_FULLPATH].Name = sFullPathProperty; ++ aSequence[PKG_MNFST_FULLPATH].Value <<= rConvertedAttribs[sFullPathAttribute]; ++ aSequence[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty; ++ aSequence[PKG_MNFST_MEDIATYPE].Value <<= rConvertedAttribs[sMediaTypeAttribute]; + + OUString sVersion = rConvertedAttribs[sVersionAttribute]; + if ( sVersion.getLength() ) { - aSequence.realloc ( PKG_SIZE_ENCR_MNFST ); -+ aSequence[nNumProperty].Name = sVersionProperty; -+ aSequence[nNumProperty++].Value <<= sVersion; ++ aSequence[PKG_MNFST_VERSION].Name = sVersionProperty; ++ aSequence[PKG_MNFST_VERSION].Value <<= sVersion; + } - // Put full-path property first for MBA @@ -825,10 +805,9 @@ index 5e9a310..f8590fe 100644 + OUString sSize = rConvertedAttribs[sSizeAttribute]; + if ( sSize.getLength() ) + { -+ sal_Int32 nSize; -+ nSize = sSize.toInt32(); -+ aSequence[nNumProperty].Name = sSizeProperty; -+ aSequence[nNumProperty++].Value <<= nSize; ++ sal_Int32 nSize = sSize.toInt32(); ++ aSequence[PKG_MNFST_UCOMPSIZE].Name = sSizeProperty; ++ aSequence[PKG_MNFST_UCOMPSIZE].Value <<= nSize; + } +} @@ -844,17 +823,17 @@ index 5e9a310..f8590fe 100644 + if ( !bIgnoreEncryptData ) + { + if ( aString.equals( sSHA1_1k_Name ) || aString.equals( sSHA1_1k_URL ) ) -+ { -+ aSequence[nNumProperty].Name = sDigestAlgProperty; -+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1_1K; -+ } -+ else if ( aString.equals( sSHA256_1k_URL ) ) { - aSequence[nNumProperty].Name = sVersionProperty; - aSequence[nNumProperty++].Value <<= sVersion; -+ aSequence[nNumProperty].Name = sDigestAlgProperty; -+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256_1K; ++ aSequence[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty; ++ aSequence[PKG_MNFST_DIGESTALG].Value <<= xml::crypto::DigestID::SHA1_1K; } ++ else if ( aString.equals( sSHA256_1k_URL ) ) ++ { ++ aSequence[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty; ++ aSequence[PKG_MNFST_DIGESTALG].Value <<= xml::crypto::DigestID::SHA256_1K; ++ } + else + bIgnoreEncryptData = sal_True; @@ -869,8 +848,8 @@ index 5e9a310..f8590fe 100644 + aString = rConvertedAttribs[sChecksumAttribute]; + uno::Sequence < sal_Int8 > aDecodeBuffer; + ::sax::Converter::decodeBase64(aDecodeBuffer, aString); -+ aSequence[nNumProperty].Name = sDigestProperty; -+ aSequence[nNumProperty++].Value <<= aDecodeBuffer; ++ aSequence[PKG_MNFST_DIGEST].Name = sDigestProperty; ++ aSequence[PKG_MNFST_DIGEST].Value <<= aDecodeBuffer; } } - else if ( aStack.size() > 1 ) @@ -886,27 +865,27 @@ index 5e9a310..f8590fe 100644 + OUString aString = rConvertedAttribs[sAlgorithmNameAttribute]; + if ( aString.equals( sBlowfish_Name ) || aString.equals( sBlowfish_URL ) ) + { -+ aSequence[nNumProperty].Name = sEncryptionAlgProperty; -+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8; ++ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty; ++ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8; + } + else if ( aString.equals( sAES256_URL ) ) + { -+ aSequence[nNumProperty].Name = sEncryptionAlgProperty; -+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; ++ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty; ++ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; + OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 32, "Unexpected derived key length!" ); + nDerivedKeySize = 32; + } + else if ( aString.equals( sAES192_URL ) ) + { -+ aSequence[nNumProperty].Name = sEncryptionAlgProperty; -+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; ++ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty; ++ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; + OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 24, "Unexpected derived key length!" ); + nDerivedKeySize = 24; + } + else if ( aString.equals( sAES128_URL ) ) + { -+ aSequence[nNumProperty].Name = sEncryptionAlgProperty; -+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; ++ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty; ++ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; + OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 16, "Unexpected derived key length!" ); + nDerivedKeySize = 16; + } @@ -941,7 +920,7 @@ index 5e9a310..f8590fe 100644 - { - aString = aConvertedAttribs[sChecksumAttribute]; - uno::Sequence < sal_Int8 > aDecodeBuffer; -- ::sax::Converter::decodeBase64(aDecodeBuffer, aString); +- Base64Codec::decodeBase64( aDecodeBuffer, aString ); - aSequence[nNumProperty].Name = sDigestProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; - } @@ -950,8 +929,8 @@ index 5e9a310..f8590fe 100644 + aString = rConvertedAttribs[sInitialisationVectorAttribute]; + uno::Sequence < sal_Int8 > aDecodeBuffer; + ::sax::Converter::decodeBase64(aDecodeBuffer, aString); -+ aSequence[nNumProperty].Name = sInitialisationVectorProperty; -+ aSequence[nNumProperty++].Value <<= aDecodeBuffer; ++ aSequence[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty; ++ aSequence[PKG_MNFST_INIVECTOR].Value <<= aDecodeBuffer; } - else if ( aIter->m_aConvertedName.equals( sEncryptionDataElement ) ) + } @@ -1003,7 +982,7 @@ index 5e9a310..f8590fe 100644 - { - aString = aConvertedAttribs[sInitialisationVectorAttribute]; - uno::Sequence < sal_Int8 > aDecodeBuffer; -- ::sax::Converter::decodeBase64(aDecodeBuffer, aString); +- Base64Codec::decodeBase64 ( aDecodeBuffer, aString ); - aSequence[nNumProperty].Name = sInitialisationVectorProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; - } @@ -1013,12 +992,12 @@ index 5e9a310..f8590fe 100644 + aString = rConvertedAttribs[sSaltAttribute]; + uno::Sequence < sal_Int8 > aDecodeBuffer; + ::sax::Converter::decodeBase64(aDecodeBuffer, aString); -+ aSequence[nNumProperty].Name = sSaltProperty; -+ aSequence[nNumProperty++].Value <<= aDecodeBuffer; ++ aSequence[PKG_MNFST_SALT].Name = sSaltProperty; ++ aSequence[PKG_MNFST_SALT].Value <<= aDecodeBuffer; + + aString = rConvertedAttribs[sIterationCountAttribute]; -+ aSequence[nNumProperty].Name = sIterationCountProperty; -+ aSequence[nNumProperty++].Value <<= aString.toInt32(); ++ aSequence[PKG_MNFST_ITERATION].Name = sIterationCountProperty; ++ aSequence[PKG_MNFST_ITERATION].Value <<= aString.toInt32(); + + aString = rConvertedAttribs[sKeySizeAttribute]; + if ( aString.getLength() ) @@ -1030,7 +1009,7 @@ index 5e9a310..f8590fe 100644 - { - aString = aConvertedAttribs[sSaltAttribute]; - uno::Sequence < sal_Int8 > aDecodeBuffer; -- ::sax::Converter::decodeBase64(aDecodeBuffer, aString); +- Base64Codec::decodeBase64 ( aDecodeBuffer, aString ); - aSequence[nNumProperty].Name = sSaltProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; - @@ -1081,8 +1060,8 @@ index 5e9a310..f8590fe 100644 + else if ( nDerivedKeySize != 16 ) + OSL_ENSURE( sal_False, "Default derived key length differs from the expected one!" ); + -+ aSequence[nNumProperty].Name = sDerivedKeySizeProperty; -+ aSequence[nNumProperty++].Value <<= nDerivedKeySize; ++ aSequence[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty; ++ aSequence[PKG_MNFST_DERKEYSIZE].Value <<= nDerivedKeySize; + } + else + bIgnoreEncryptData = sal_True; @@ -1095,13 +1074,13 @@ index 5e9a310..f8590fe 100644 + OUString aString = rConvertedAttribs[sStartKeyAlgNameAttribute]; + if ( aString.equals( sSHA256_URL ) ) + { -+ aSequence[nNumProperty].Name = sStartKeyAlgProperty; -+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256; ++ aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty; ++ aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA256; + } + else if ( aString.equals( sSHA1_Name ) || aString.equals( sSHA1_URL ) ) + { -+ aSequence[nNumProperty].Name = sStartKeyAlgProperty; -+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1; ++ aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty; ++ aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA1; + } + else + bIgnoreEncryptData = sal_True; @@ -1133,7 +1112,7 @@ index 5e9a310..f8590fe 100644 + else + aStack.back().m_bValid = false; + break; -+ } + } + case 3: + { + ManifestStack::reverse_iterator aIter = aStack.rbegin(); @@ -1163,284 +1142,22 @@ index 5e9a310..f8590fe 100644 + else + aStack.back().m_bValid = false; + break; - } ++ } + default: + aStack.back().m_bValid = false; + break; - } - } - -diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx -index 1c646a7..5681f45 100644 ---- a/package/source/manifest/ManifestImport.hxx -+++ b/package/source/manifest/ManifestImport.hxx -@@ -46,10 +46,12 @@ struct ManifestScopeEntry - { - ::rtl::OUString m_aConvertedName; - StringHashMap m_aNamespaces; -+ bool m_bValid; - - ManifestScopeEntry( const ::rtl::OUString& aConvertedName, const StringHashMap& aNamespaces ) - : m_aConvertedName( aConvertedName ) - , m_aNamespaces( aNamespaces ) -+ , m_bValid( true ) - {} - - ~ManifestScopeEntry() -@@ -148,6 +150,12 @@ public: - throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) - throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); -+private: -+ void doFileEntry(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException); -+ void doEncryptionData(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException); -+ void doAlgorithm(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException); -+ void doKeyDerivation(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException); -+ void doStartKeyAlg(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException); - }; - #endif - --- -cgit v0.9.0.2-2-gbebe - -From 4a7164429b727bd8fd6f183950e85e6225869364 Mon Sep 17 00:00:00 2001 -From: Caolán McNamara <caol...@redhat.com> -Date: Mon, 28 May 2012 10:43:09 +0000 -Subject: count and order of receipt of properties doesn't matter - -so stick imported properties into assigned slots and throw out empty ones when -finished. Reuse existing ids for this between import and export. Shuffle -FULLPATH to 0 as per import comment - -Change-Id: I516116c5327498ad043f6e2fb9bd257599ade2a2 ---- -diff --git a/package/inc/PackageConstants.hxx b/package/inc/PackageConstants.hxx -index be82010..7590acd 100644 ---- a/package/inc/PackageConstants.hxx -+++ b/package/inc/PackageConstants.hxx -@@ -40,19 +40,19 @@ const sal_Int32 n_ConstDigestLength = 1024; - const sal_Int32 n_ConstDigestDecrypt = 1056; // 1024 + 32 - - // the constants related to the manifest.xml entries --#define PKG_MNFST_MEDIATYPE 0 --#define PKG_MNFST_VERSION 1 --#define PKG_MNFST_FULLPATH 2 -+#define PKG_MNFST_FULLPATH 0 //FullPath (Put full-path property first for MBA) -+#define PKG_MNFST_VERSION 1 //Version -+#define PKG_MNFST_MEDIATYPE 2 //MediaType - --#define PKG_MNFST_INIVECTOR 3 --#define PKG_MNFST_SALT 4 --#define PKG_MNFST_ITERATION 5 --#define PKG_MNFST_UCOMPSIZE 6 --#define PKG_MNFST_DIGEST 7 --#define PKG_MNFST_ENCALG 8 --#define PKG_MNFST_STARTALG 9 --#define PKG_MNFST_DIGESTALG 10 --#define PKG_MNFST_DERKEYSIZE 11 -+#define PKG_MNFST_INIVECTOR 3 //InitialisationVector -+#define PKG_MNFST_SALT 4 //Salt -+#define PKG_MNFST_ITERATION 5 //IterationCount -+#define PKG_MNFST_UCOMPSIZE 6 //Size -+#define PKG_MNFST_DIGEST 7 //Digest -+#define PKG_MNFST_ENCALG 8 //EncryptionAlgorithm -+#define PKG_MNFST_STARTALG 9 //StartKeyAlgorithm -+#define PKG_MNFST_DIGESTALG 10 //DigestAlgorithm -+#define PKG_MNFST_DERKEYSIZE 11 //DerivedKeySize - - #define PKG_SIZE_NOENCR_MNFST 3 - #define PKG_SIZE_ENCR_MNFST 12 -diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx -index f8590fe..ac6c3ef 100644 ---- a/package/source/manifest/ManifestImport.cxx -+++ b/package/source/manifest/ManifestImport.cxx -@@ -44,8 +44,7 @@ using ::rtl::OUString; - - // --------------------------------------------------- - ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector ) --: nNumProperty ( 0 ) --, bIgnoreEncryptData ( sal_False ) -+: bIgnoreEncryptData ( sal_False ) - , nDerivedKeySize( 0 ) - , rManVector ( rNewManVector ) - -@@ -126,28 +125,26 @@ void SAL_CALL ManifestImport::endDocument( ) - void ManifestImport::doFileEntry(StringHashMap &rConvertedAttribs) - throw( uno::RuntimeException ) - { -- aSequence.realloc ( PKG_SIZE_ENCR_MNFST ); -+ aSequence.resize(PKG_SIZE_ENCR_MNFST); - -- // Put full-path property first for MBA -- aSequence[nNumProperty].Name = sFullPathProperty; -- aSequence[nNumProperty++].Value <<= rConvertedAttribs[sFullPathAttribute]; -- aSequence[nNumProperty].Name = sMediaTypeProperty; -- aSequence[nNumProperty++].Value <<= rConvertedAttribs[sMediaTypeAttribute]; -+ aSequence[PKG_MNFST_FULLPATH].Name = sFullPathProperty; -+ aSequence[PKG_MNFST_FULLPATH].Value <<= rConvertedAttribs[sFullPathAttribute]; -+ aSequence[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty; -+ aSequence[PKG_MNFST_MEDIATYPE].Value <<= rConvertedAttribs[sMediaTypeAttribute]; - - OUString sVersion = rConvertedAttribs[sVersionAttribute]; - if ( sVersion.getLength() ) - { -- aSequence[nNumProperty].Name = sVersionProperty; -- aSequence[nNumProperty++].Value <<= sVersion; -+ aSequence[PKG_MNFST_VERSION].Name = sVersionProperty; -+ aSequence[PKG_MNFST_VERSION].Value <<= sVersion; - } - - OUString sSize = rConvertedAttribs[sSizeAttribute]; - if ( sSize.getLength() ) - { -- sal_Int32 nSize; -- nSize = sSize.toInt32(); -- aSequence[nNumProperty].Name = sSizeProperty; -- aSequence[nNumProperty++].Value <<= nSize; -+ sal_Int32 nSize = sSize.toInt32(); -+ aSequence[PKG_MNFST_UCOMPSIZE].Name = sSizeProperty; -+ aSequence[PKG_MNFST_UCOMPSIZE].Value <<= nSize; - } - } - -@@ -162,13 +159,13 @@ void ManifestImport::doEncryptionData(StringHashMap &rConvertedAttribs) - { - if ( aString.equals( sSHA1_1k_Name ) || aString.equals( sSHA1_1k_URL ) ) - { -- aSequence[nNumProperty].Name = sDigestAlgProperty; -- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1_1K; -+ aSequence[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty; -+ aSequence[PKG_MNFST_DIGESTALG].Value <<= xml::crypto::DigestID::SHA1_1K; - } - else if ( aString.equals( sSHA256_1k_URL ) ) - { -- aSequence[nNumProperty].Name = sDigestAlgProperty; -- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256_1K; -+ aSequence[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty; -+ aSequence[PKG_MNFST_DIGESTALG].Value <<= xml::crypto::DigestID::SHA256_1K; - } - else - bIgnoreEncryptData = sal_True; -@@ -178,8 +175,8 @@ void ManifestImport::doEncryptionData(StringHashMap &rConvertedAttribs) - aString = rConvertedAttribs[sChecksumAttribute]; - uno::Sequence < sal_Int8 > aDecodeBuffer; - ::sax::Converter::decodeBase64(aDecodeBuffer, aString); -- aSequence[nNumProperty].Name = sDigestProperty; -- aSequence[nNumProperty++].Value <<= aDecodeBuffer; -+ aSequence[PKG_MNFST_DIGEST].Name = sDigestProperty; -+ aSequence[PKG_MNFST_DIGEST].Value <<= aDecodeBuffer; - } - } - } -@@ -192,27 +189,27 @@ void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs) - OUString aString = rConvertedAttribs[sAlgorithmNameAttribute]; - if ( aString.equals( sBlowfish_Name ) || aString.equals( sBlowfish_URL ) ) - { -- aSequence[nNumProperty].Name = sEncryptionAlgProperty; -- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8; -+ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty; -+ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8; - } - else if ( aString.equals( sAES256_URL ) ) - { -- aSequence[nNumProperty].Name = sEncryptionAlgProperty; -- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; -+ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty; -+ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; - OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 32, "Unexpected derived key length!" ); - nDerivedKeySize = 32; - } - else if ( aString.equals( sAES192_URL ) ) - { -- aSequence[nNumProperty].Name = sEncryptionAlgProperty; -- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; -+ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty; -+ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; - OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 24, "Unexpected derived key length!" ); - nDerivedKeySize = 24; - } - else if ( aString.equals( sAES128_URL ) ) - { -- aSequence[nNumProperty].Name = sEncryptionAlgProperty; -- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; -+ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty; -+ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING; - OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 16, "Unexpected derived key length!" ); - nDerivedKeySize = 16; - } -@@ -224,8 +221,8 @@ void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs) - aString = rConvertedAttribs[sInitialisationVectorAttribute]; - uno::Sequence < sal_Int8 > aDecodeBuffer; - ::sax::Converter::decodeBase64(aDecodeBuffer, aString); -- aSequence[nNumProperty].Name = sInitialisationVectorProperty; -- aSequence[nNumProperty++].Value <<= aDecodeBuffer; -+ aSequence[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty; -+ aSequence[PKG_MNFST_INIVECTOR].Value <<= aDecodeBuffer; - } - } - } -@@ -241,12 +238,12 @@ void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs) - aString = rConvertedAttribs[sSaltAttribute]; - uno::Sequence < sal_Int8 > aDecodeBuffer; - ::sax::Converter::decodeBase64(aDecodeBuffer, aString); -- aSequence[nNumProperty].Name = sSaltProperty; -- aSequence[nNumProperty++].Value <<= aDecodeBuffer; -+ aSequence[PKG_MNFST_SALT].Name = sSaltProperty; -+ aSequence[PKG_MNFST_SALT].Value <<= aDecodeBuffer; - - aString = rConvertedAttribs[sIterationCountAttribute]; -- aSequence[nNumProperty].Name = sIterationCountProperty; -- aSequence[nNumProperty++].Value <<= aString.toInt32(); -+ aSequence[PKG_MNFST_ITERATION].Name = sIterationCountProperty; -+ aSequence[PKG_MNFST_ITERATION].Value <<= aString.toInt32(); - - aString = rConvertedAttribs[sKeySizeAttribute]; - if ( aString.getLength() ) -@@ -260,8 +257,8 @@ void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs) - else if ( nDerivedKeySize != 16 ) - OSL_ENSURE( sal_False, "Default derived key length differs from the expected one!" ); - -- aSequence[nNumProperty].Name = sDerivedKeySizeProperty; -- aSequence[nNumProperty++].Value <<= nDerivedKeySize; -+ aSequence[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty; -+ aSequence[PKG_MNFST_DERKEYSIZE].Value <<= nDerivedKeySize; - } - else - bIgnoreEncryptData = sal_True; -@@ -274,13 +271,13 @@ void ManifestImport::doStartKeyAlg(StringHashMap &rConvertedAttribs) - OUString aString = rConvertedAttribs[sStartKeyAlgNameAttribute]; - if ( aString.equals( sSHA256_URL ) ) - { -- aSequence[nNumProperty].Name = sStartKeyAlgProperty; -- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256; -+ aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty; -+ aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA256; - } - else if ( aString.equals( sSHA1_Name ) || aString.equals( sSHA1_URL ) ) - { -- aSequence[nNumProperty].Name = sStartKeyAlgProperty; -- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1; -+ aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty; -+ aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA1; - } - else - bIgnoreEncryptData = sal_True; -@@ -349,6 +346,14 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re - } - } - ++ } ++} ++ +namespace +{ + bool isEmpty(const com::sun::star::beans::PropertyValue &rProp) + { + return rProp.Name.isEmpty(); -+ } -+} -+ - // --------------------------------------------------- - void SAL_CALL ManifestImport::endElement( const OUString& aName ) - throw( xml::sax::SAXException, uno::RuntimeException ) -@@ -356,12 +361,16 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName ) + } + } + +@@ -304,12 +361,16 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName ) ::rtl::OUString aConvertedName = ConvertName( aName ); if ( !aStack.empty() && aStack.rbegin()->m_aConvertedName.equals( aConvertedName ) ) { @@ -1462,7 +1179,7 @@ index f8590fe..ac6c3ef 100644 aStack.pop_back(); diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx -index 5681f45..68afefd 100644 +index 1c646a7..68afefd 100644 --- a/package/source/manifest/ManifestImport.hxx +++ b/package/source/manifest/ManifestImport.hxx @@ -31,6 +31,7 @@ @@ -1473,7 +1190,20 @@ index 5681f45..68afefd 100644 #include <vector> #include <HashMaps.hxx> -@@ -63,8 +64,7 @@ typedef ::std::vector< ManifestScopeEntry > ManifestStack; +@@ -46,10 +47,12 @@ struct ManifestScopeEntry + { + ::rtl::OUString m_aConvertedName; + StringHashMap m_aNamespaces; ++ bool m_bValid; + + ManifestScopeEntry( const ::rtl::OUString& aConvertedName, const StringHashMap& aNamespaces ) + : m_aConvertedName( aConvertedName ) + , m_aNamespaces( aNamespaces ) ++ , m_bValid( true ) + {} + + ~ManifestScopeEntry() +@@ -61,8 +64,7 @@ typedef ::std::vector< ManifestScopeEntry > ManifestStack; class ManifestImport : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler > { protected: @@ -1483,5 +1213,51 @@ index 5681f45..68afefd 100644 ManifestStack aStack; sal_Bool bIgnoreEncryptData; sal_Int32 nDerivedKeySize; --- -cgit v0.9.0.2-2-gbebe +@@ -148,6 +150,12 @@ public: + throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) + throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); ++private: ++ void doFileEntry(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException); ++ void doEncryptionData(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException); ++ void doAlgorithm(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException); ++ void doKeyDerivation(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException); ++ void doStartKeyAlg(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException); + }; + #endif + +diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx +index 16d5a00..f154dfe 100644 +--- a/package/source/zipapi/ZipFile.cxx ++++ b/package/source/zipapi/ZipFile.cxx +@@ -157,6 +157,12 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un + + try + { ++ if (xEncryptionData->m_nDerivedKeySize < 0) ++ { ++ throw ZipIOException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid derived key length!") ), ++ uno::Reference< XInterface >() ); ++ } ++ + uno::Sequence< sal_Int8 > aDerivedKey( xEncryptionData->m_nDerivedKeySize ); + if ( rtl_Digest_E_None != rtl_digest_PBKDF2( reinterpret_cast< sal_uInt8* >( aDerivedKey.getArray() ), + aDerivedKey.getLength(), +@@ -192,7 +198,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un + uno::Reference< XInterface >() ); + } + } +- catch( uno::Exception& ) ++ catch( ... ) + { + OSL_ENSURE( sal_False, "Can not create cipher context!" ); + } +@@ -699,7 +705,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry ) + || rEntry.nPathLen != nPathLen + || !rEntry.sPath.equals( sLOCPath ); + } +- catch(::std::bad_alloc &) ++ catch(...) + { + bBroken = sal_True; + } -- LibreOffice packaging repository -- To UNSUBSCRIBE, email to debian-openoffice-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1sx1bb-0003o5...@vasks.debian.org