[Libreoffice-commits] core.git: 3 commits - include/oox oox/source sw/qa sw/source

Caolán McNamara caolanm at redhat.com
Mon Aug 24 06:32:52 PDT 2015


 include/oox/export/drawingml.hxx    |    2 -
 oox/source/export/drawingml.cxx     |   50 ++++++++----------------------------
 sw/qa/core/data/ww5/pass/hang-2.doc |binary
 sw/source/filter/ww8/ww8scan.cxx    |    7 ++---
 sw/source/filter/ww8/ww8toolbar.cxx |   14 +++++++---
 5 files changed, 26 insertions(+), 47 deletions(-)

New commits:
commit 48a047f2f4e7b4b3bed33a99d37fd48025381646
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 24 14:21:44 2015 +0100

    allow avoiding config for CustomToolBarImportHelper
    
    Change-Id: Iff0dd632f8c6b187d3515f542cc9fe2ca59088e5

diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index 6460cc6..f9e6122 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -21,6 +21,7 @@
 #include <com/sun/star/ui/ItemType.hpp>
 #include <fstream>
 #include <comphelper/processfactory.hxx>
+#include <unotools/configmgr.hxx>
 #include <vcl/graph.hxx>
 #include <map>
 #include <sal/log.hxx>
@@ -227,15 +228,20 @@ bool SwCTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
     {
         try
         {
-            uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
-            uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( ui::theModuleUIConfigurationManagerSupplier::get(xContext) );
-            CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( "com.sun.star.text.TextDocument" ) );
+            css::uno::Reference<css::ui::XUIConfigurationManager> xCfgMgr;
+            if (!utl::ConfigManager::IsAvoidConfig())
+            {
+                uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+                uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( ui::theModuleUIConfigurationManagerSupplier::get(xContext) );
+                xCfgMgr = xAppCfgSupp->getUIConfigurationManager("com.sun.star.text.TextDocument");
+            }
+            CustomToolBarImportHelper helper(rDocSh, xCfgMgr);
             helper.setMSOCommandMap( new MSOWordCommandConvertor() );
 
             if ( !(*it).ImportCustomToolBar( *this, helper ) )
                 return false;
         }
-        catch(...)
+        catch (...)
         {
             continue;
         }
commit c0c9075163f06c0b5c2ad9cf428f1cfacf9fe1fb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 24 14:05:00 2015 +0100

    limit seeks to valid area
    
    Change-Id: I401d93491999a3fc3db4f597eea9c4fe5b9bc926

diff --git a/sw/qa/core/data/ww5/pass/hang-2.doc b/sw/qa/core/data/ww5/pass/hang-2.doc
new file mode 100644
index 0000000..5f76093
Binary files /dev/null and b/sw/qa/core/data/ww5/pass/hang-2.doc differ
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 4548a4f..19e8132 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -6704,8 +6704,7 @@ WW8Dop::WW8Dop(SvStream& rSt, sal_Int16 nFib, sal_Int32 nPos, sal_uInt32 nSize)
     sal_uInt8* pData = pDataPtr;
 
     sal_uInt32 nRead = nMaxDopSize < nSize ? nMaxDopSize : nSize;
-    rSt.Seek( nPos );
-    if (2 > nSize || nRead != rSt.Read(pData, nRead))
+    if (nSize < 2 || !checkSeek(rSt, nPos) || nRead != rSt.Read(pData, nRead))
         nDopError = ERR_SWG_READ_ERROR;     // report error
     else
     {
@@ -7550,8 +7549,8 @@ SEPr::SEPr() :
 
 bool checkSeek(SvStream &rSt, sal_uInt32 nOffset)
 {
-    return (nOffset != SAL_MAX_UINT32 &&
-            rSt.Seek(nOffset) == static_cast<sal_Size>(nOffset));
+    const sal_uInt64 nMaxSeek(rSt.Tell() + rSt.remainingSize());
+    return (nOffset <= nMaxSeek && rSt.Seek(nOffset) == nOffset);
 }
 
 bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength)
commit 479862c75094bcd4d49d2cca4e29a298618e7665
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 24 13:15:05 2015 +0100

    coverity#1317300 Untrusted array index read
    
    Change-Id: Ia9fe42974ffe24f6a679396b5d7ca672c0459f4b

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 3b9d847..bfd3c6c 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -190,7 +190,7 @@ public:
 
     static void ResetCounters();
 
-    static void GetUUID( OStringBuffer& rBuffer );
+    static OString GetUUID();
 
     static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc );
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 52dc142e..a153ff2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1475,44 +1475,20 @@ const char* DrawingML::GetFieldType( ::com::sun::star::uno::Reference< ::com::su
     return sType;
 }
 
-void DrawingML::GetUUID( OStringBuffer& rBuffer )
+OString DrawingML::GetUUID()
 {
     sal_uInt8 aSeq[16];
-    static const char cDigits[17] = "0123456789ABCDEF";
-    rtl_createUuid( aSeq, 0, true );
-    int i;
+    rtl_createUuid(aSeq, 0, true);
 
-    rBuffer.append( '{' );
-    for( i = 0; i < 4; i++ )
-    {
-        rBuffer.append( cDigits[ aSeq[i] >> 4 ] );
-        rBuffer.append( cDigits[ aSeq[i] & 0xf ] );
-    }
-    rBuffer.append( '-' );
-    for( ; i < 6; i++ )
-    {
-        rBuffer.append( cDigits[ aSeq[i] >> 4 ] );
-        rBuffer.append( cDigits[ aSeq[i] & 0xf ] );
-    }
-    rBuffer.append( '-' );
-    for( ; i < 8; i++ )
-    {
-        rBuffer.append( cDigits[ aSeq[i] >> 4 ] );
-        rBuffer.append( cDigits[ aSeq[i] & 0xf ] );
-    }
-    rBuffer.append( '-' );
-    for( ; i < 10; i++ )
-    {
-        rBuffer.append( cDigits[ aSeq[i] >> 4 ] );
-        rBuffer.append( cDigits[ aSeq[i] & 0xf ] );
-    }
-    rBuffer.append( '-' );
-    for( ; i < 16; i++ )
-    {
-        rBuffer.append( cDigits[ aSeq[i] >> 4 ] );
-        rBuffer.append( cDigits[ aSeq[i] & 0xf ] );
-    }
-    rBuffer.append( '}' );
+    char str[39];
+    sprintf(str, "{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+        aSeq[0], aSeq[1], aSeq[2], aSeq[3],
+        aSeq[4], aSeq[5],
+        aSeq[6], aSeq[7],
+        aSeq[8], aSeq[9],
+        aSeq[10], aSeq[11], aSeq[12], aSeq[13], aSeq[14], aSeq[15]);
+
+    return OString(str, SAL_N_ELEMENTS(str));
 }
 
 void DrawingML::WriteRun( Reference< XTextRange > rRun )
@@ -1549,9 +1525,7 @@ void DrawingML::WriteRun( Reference< XTextRange > rRun )
     sFieldType = GetFieldType( rRun, bIsField );
     if( ( sFieldType != NULL ) )
     {
-        OStringBuffer sUUID(39);
-
-        GetUUID( sUUID );
+        OString sUUID(GetUUID());
         mpFS->startElementNS( XML_a, XML_fld,
                               XML_id, sUUID.getStr(),
                               XML_type, sFieldType,


More information about the Libreoffice-commits mailing list