[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 25 20:01:16 UTC 2018


 sc/source/filter/excel/xihelper.cxx |   12 ++++++------
 sc/source/filter/inc/xihelper.hxx   |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 6d6b4df2c2e979ab0fadc96ae20bb23e86df1ae0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 25 16:12:54 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jul 25 22:00:51 2018 +0200

    ofz#8373 tight OUString concat loop causes libfuzzer oom
    
    it doesn't get a chance to release memory and falls over with
    an oom. Or something like that anyway.
    
    Change-Id: I9d8dd704fb63d70755c6c1b211db6fe9d99cc2e5
    Reviewed-on: https://gerrit.libreoffice.org/57987
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index 9ce3c500c9fa..04525d44a47c 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -283,7 +283,7 @@ void XclImpHFConverter::ParseString( const OUString& rHFString )
     meCurrObj = EXC_HF_CENTER;
 
     // parser temporaries
-    maCurrText.clear();
+    maCurrText.truncate();
     OUString aReadFont;           // current font name
     OUString aReadStyle;          // current font style
     sal_uInt16 nReadHeight = 0; // current font height
@@ -321,7 +321,7 @@ void XclImpHFConverter::ParseString( const OUString& rHFString )
                         InsertLineBreak();
                     break;
                     default:
-                        maCurrText += OUStringLiteral1(*pChar);
+                        maCurrText.append(OUStringLiteral1(*pChar));
                 }
             }
             break;
@@ -333,7 +333,7 @@ void XclImpHFConverter::ParseString( const OUString& rHFString )
                 eState = xlPSText;
                 switch( *pChar )
                 {
-                    case '&':   maCurrText += "&";  break;  // the '&' character
+                    case '&':   maCurrText.append("&");  break;  // the '&' character
 
                     case 'L':   SetNewPortion( EXC_HF_LEFT );   break;  // Left portion
                     case 'C':   SetNewPortion( EXC_HF_CENTER ); break;  // Center portion
@@ -538,9 +538,9 @@ void XclImpHFConverter::InsertText()
     if( !maCurrText.isEmpty() )
     {
         ESelection& rSel = GetCurrSel();
-        mrEE.QuickInsertText( maCurrText, ESelection( rSel.nEndPara, rSel.nEndPos, rSel.nEndPara, rSel.nEndPos ) );
-        rSel.nEndPos = rSel.nEndPos + maCurrText.getLength();
-        maCurrText.clear();
+        OUString sString(maCurrText.makeStringAndClear());
+        mrEE.QuickInsertText( sString, ESelection( rSel.nEndPara, rSel.nEndPos, rSel.nEndPara, rSel.nEndPos ) );
+        rSel.nEndPos = rSel.nEndPos + sString.getLength();
         UpdateCurrMaxLineHeight();
     }
 }
diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx
index 8f64e2fd606c..15c76bd839d6 100644
--- a/sc/source/filter/inc/xihelper.hxx
+++ b/sc/source/filter/inc/xihelper.hxx
@@ -240,7 +240,7 @@ private:
 private:
     EditEngine&         mrEE;               /// The header/footer edit engine.
     XclImpHFPortionInfoVec maInfos;         /// Edit engine text objects for all portions.
-    OUString            maCurrText;         /// Current text to insert into edit engine.
+    OUStringBuffer      maCurrText;         /// Current text to insert into edit engine.
     XclFontDataPtr      mxFontData;         /// Font data of current text.
     XclImpHFPortion     meCurrObj;          /// The current portion.
 };


More information about the Libreoffice-commits mailing list