[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.3' - 2 commits - oox/source vcl/source

Tor Lillqvist tml at collabora.com
Wed Mar 11 07:38:53 PDT 2015


 oox/source/export/shapes.cxx      |  110 +++++++++++++++++++-------------------
 vcl/source/gdi/pdfwriter_impl.cxx |   22 +++----
 2 files changed, 66 insertions(+), 66 deletions(-)

New commits:
commit 53711be9ecdb4923f1229562514bf11016d323e8
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Mar 11 16:32:16 2015 +0200

    Fix compilation error with gcc 4.7
    
    Change-Id: I07080c0d42029b7e44f4a6104c18dd75c7356ae0

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 5b2f4ee..a324d27 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -292,59 +292,59 @@ ShapeExport& ShapeExport::WriteGroupShape(uno::Reference<drawing::XShape> xShape
 static bool lcl_IsOnBlacklist(OUString& rShapeType)
 {
     OUString aBlacklist[] = {
-            "ring",
-            "can",
-            "cube",
-            "paper",
-            "frame",
-            "smiley",
-            "sun",
-            "flower",
-            "forbidden",
-            "bracket-pair",
-            "brace-pair",
-            "col-60da8460",
-            "col-502ad400",
-            "quad-bevel",
-            "cloud-callout",
-            "line-callout-1",
-            "line-callout-2",
-            "line-callout-3",
-            "paper",
-            "vertical-scroll",
-            "horizontal-scroll",
-            "mso-spt34",
-            "mso-spt75",
-            "mso-spt164",
-            "mso-spt180",
-            "flowchart-process",
-            "flowchart-alternate-process",
-            "flowchart-decision",
-            "flowchart-data",
-            "flowchart-predefined-process",
-            "flowchart-internal-storage",
-            "flowchart-document",
-            "flowchart-multidocument",
-            "flowchart-terminator",
-            "flowchart-preparation",
-            "flowchart-manual-input",
-            "flowchart-manual-operation",
-            "flowchart-connector",
-            "flowchart-off-page-connector",
-            "flowchart-card",
-            "flowchart-punched-tape",
-            "flowchart-summing-junction",
-            "flowchart-or",
-            "flowchart-collate",
-            "flowchart-sort",
-            "flowchart-extract",
-            "flowchart-merge",
-            "flowchart-stored-data",
-            "flowchart-delay",
-            "flowchart-sequential-access",
-            "flowchart-magnetic-disk",
-            "flowchart-direct-access-storage",
-            "flowchart-display"
+            OUString("ring"),
+            OUString("can"),
+            OUString("cube"),
+            OUString("paper"),
+            OUString("frame"),
+            OUString("smiley"),
+            OUString("sun"),
+            OUString("flower"),
+            OUString("forbidden"),
+            OUString("bracket-pair"),
+            OUString("brace-pair"),
+            OUString("col-60da8460"),
+            OUString("col-502ad400"),
+            OUString("quad-bevel"),
+            OUString("cloud-callout"),
+            OUString("line-callout-1"),
+            OUString("line-callout-2"),
+            OUString("line-callout-3"),
+            OUString("paper"),
+            OUString("vertical-scroll"),
+            OUString("horizontal-scroll"),
+            OUString("mso-spt34"),
+            OUString("mso-spt75"),
+            OUString("mso-spt164"),
+            OUString("mso-spt180"),
+            OUString("flowchart-process"),
+            OUString("flowchart-alternate-process"),
+            OUString("flowchart-decision"),
+            OUString("flowchart-data"),
+            OUString("flowchart-predefined-process"),
+            OUString("flowchart-internal-storage"),
+            OUString("flowchart-document"),
+            OUString("flowchart-multidocument"),
+            OUString("flowchart-terminator"),
+            OUString("flowchart-preparation"),
+            OUString("flowchart-manual-input"),
+            OUString("flowchart-manual-operation"),
+            OUString("flowchart-connector"),
+            OUString("flowchart-off-page-connector"),
+            OUString("flowchart-card"),
+            OUString("flowchart-punched-tape"),
+            OUString("flowchart-summing-junction"),
+            OUString("flowchart-or"),
+            OUString("flowchart-collate"),
+            OUString("flowchart-sort"),
+            OUString("flowchart-extract"),
+            OUString("flowchart-merge"),
+            OUString("flowchart-stored-data"),
+            OUString("flowchart-delay"),
+            OUString("flowchart-sequential-access"),
+            OUString("flowchart-magnetic-disk"),
+            OUString("flowchart-direct-access-storage"),
+            OUString("flowchart-display")
     };
     std::vector<OUString> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist));
 
@@ -354,8 +354,8 @@ static bool lcl_IsOnBlacklist(OUString& rShapeType)
 static bool lcl_IsOnWhitelist(OUString& rShapeType)
 {
     OUString aWhitelist[] = {
-            "heart",
-            "puzzle"
+            OUString("heart"),
+            OUString("puzzle")
     };
     std::vector<OUString> vWhitelist(aWhitelist, aWhitelist + SAL_N_ELEMENTS(aWhitelist));
 
commit a7e691d92a27de61d5e140138071cc1cfd666e35
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Mar 10 16:07:57 2015 +0200

    Fix signature overflow check in the NSS case
    
    We didn't actually check this correctly at all, but gladly overwrote the
    allocated part of the output PDF, thus obviously rendering it invalid.
    
    The parameter passed to PORT_NewArea is a default chunk size, not a maximum
    anything, so it was misleading, even if not wrong as such, to pass
    MAX_SIGNATURE_CONTENT_LENGTH to it. Use 10000 instead.
    
    No need to do the overflow check twice in the Win32 case.
    
    Change-Id: Ifa796dbb74b32e857f7184c1e8ada97ba124b020

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 27f2c1b..8fb4f36 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6884,7 +6884,7 @@ bool PDFWriterImpl::finalizeSignature()
         SECItem ts_cms_output;
         ts_cms_output.data = 0;
         ts_cms_output.len = 0;
-        PLArenaPool *ts_arena = PORT_NewArena(MAX_SIGNATURE_CONTENT_LENGTH);
+        PLArenaPool *ts_arena = PORT_NewArena(10000);
         NSSCMSEncoderContext *ts_cms_ecx;
         ts_cms_ecx = NSS_CMSEncoder_Start(ts_cms_msg, NULL, NULL, &ts_cms_output, ts_arena, PDFSigningPKCS7PasswordCallback, pass, NULL, NULL, NULL, NULL);
 
@@ -7163,7 +7163,7 @@ bool PDFWriterImpl::finalizeSignature()
     SECItem cms_output;
     cms_output.data = 0;
     cms_output.len = 0;
-    PLArenaPool *arena = PORT_NewArena(MAX_SIGNATURE_CONTENT_LENGTH);
+    PLArenaPool *arena = PORT_NewArena(10000);
     NSSCMSEncoderContext *cms_ecx;
 
     // Possibly it would work to even just pass NULL for the password callback function and its
@@ -7197,11 +7197,20 @@ bool PDFWriterImpl::finalizeSignature()
     }
 #endif
 
+    if (cms_output.len*2 > MAX_SIGNATURE_CONTENT_LENGTH)
+    {
+        SAL_WARN("vcl.pdfwriter", "Signature requires more space (" << cms_output.len*2 << ") than we reserved (" << MAX_SIGNATURE_CONTENT_LENGTH << ")");
+        NSS_CMSMessage_Destroy(cms_msg);
+        return false;
+    }
+
     OStringBuffer cms_hexbuffer;
 
     for (unsigned int i = 0; i < cms_output.len ; i++)
         appendHex(cms_output.data[i], cms_hexbuffer);
 
+    assert(cms_hexbuffer.getLength() <= MAX_SIGNATURE_CONTENT_LENGTH);
+
     // Set file pointer to the m_nSignatureContentOffset, we're ready to overwrite PKCS7 object
     nWritten = 0;
     CHECK_RETURN( (osl_File_E_None == osl_setFilePos( m_aFile, osl_Pos_Absolut, m_nSignatureContentOffset) ) );
@@ -7359,15 +7368,6 @@ bool PDFWriterImpl::finalizeSignature()
             return false;
         }
 
-        if (nTsSigLen*2 > MAX_SIGNATURE_CONTENT_LENGTH)
-        {
-            SAL_WARN("vcl.pdfwriter", "Signature requires more space (" << nTsSigLen*2 << ") than we reserved (" << MAX_SIGNATURE_CONTENT_LENGTH << ")");
-            CryptMsgClose(hDecodedMsg);
-            CryptMsgClose(hMsg);
-            CertFreeCertificateContext(pCertContext);
-            return false;
-        }
-
         SAL_INFO("vcl.pdfwriter", "nTsSigLen=" << nTsSigLen);
 
         boost::scoped_array<BYTE> pTsSig(new BYTE[nTsSigLen]);


More information about the Libreoffice-commits mailing list