[Libreoffice-commits] .: Branch 'libreoffice-3-6' - unotools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 25 08:43:49 PDT 2012


 unotools/source/config/securityoptions.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 40056c63748367db5ff60151ec2c2cb34e0cf0dd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Sep 25 15:41:42 2012 +0200

    fdo#55019: Cope with empty TrustedAuthor entries
    
    Change-Id: I9c01c1c718897a4be992150170a6ed9b5bd8a0a0
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx
index 01e1abd..7429e2b 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -35,6 +35,7 @@
 #include <com/sun/star/uno/Sequence.hxx>
 
 #include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/sequenceasvector.hxx>
 #include <tools/urlobj.hxx>
 #include <tools/wldcrd.hxx>
 
@@ -490,7 +491,7 @@ void SvtSecurityOptions_Impl::LoadAuthors( void )
         Sequence< Any >         lValues = GetProperties( lAllAuthors );
         if( lValues.getLength() == c2 )
         {
-            m_seqTrustedAuthors.realloc( c1 );
+            comphelper::SequenceAsVector< SvtSecurityOptions::Certificate > v;
             SvtSecurityOptions::Certificate aCert( 3 );
             for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 )
             {
@@ -500,8 +501,16 @@ void SvtSecurityOptions_Impl::LoadAuthors( void )
                 ++i2;
                 lValues[ i2 ] >>= aCert[ 2 ];
                 ++i2;
-                m_seqTrustedAuthors[ i1 ] = aCert;
+                // Filter out TrustedAuthor entries with empty RawData, which
+                // would cause an unexpected std::bad_alloc in
+                // SecurityEnvironment_NssImpl::createCertificateFromAscii and
+                // have been observed in the wild (fdo#55019):
+                if( !aCert[ 2 ].isEmpty() )
+                {
+                    v.push_back( aCert );
+                }
             }
+            m_seqTrustedAuthors = v.getAsConstList();
         }
     }
 }


More information about the Libreoffice-commits mailing list