[Libreoffice-commits] core.git: 2 commits - lotuswordpro/source starmath/inc starmath/source

Caolán McNamara caolanm at redhat.com
Wed Mar 1 14:12:53 UTC 2017


 lotuswordpro/source/filter/lwpfilter.cxx |    5 ++++-
 starmath/inc/document.hxx                |    8 ++++----
 starmath/source/document.cxx             |   16 +++++++---------
 starmath/source/edit.cxx                 |    2 +-
 4 files changed, 16 insertions(+), 15 deletions(-)

New commits:
commit a42d9c5b541d637dcf24086e30f341b30e03c4c7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 1 14:11:47 2017 +0000

    ofz: oom on seeks past end of SvMemoryStream
    
    cause it grows to fit if its a resizable stream
    
    Change-Id: I28b42becdfc8eb591d19d2512cdc1f1ec32c3bbe

diff --git a/lotuswordpro/source/filter/lwpfilter.cxx b/lotuswordpro/source/filter/lwpfilter.cxx
index f2fe380..8f8c8a3 100644
--- a/lotuswordpro/source/filter/lwpfilter.cxx
+++ b/lotuswordpro/source/filter/lwpfilter.cxx
@@ -104,7 +104,7 @@ using namespace OpenStormBento;
 bool Decompress(SvStream *pCompressed, SvStream * & pOutDecompressed)
 {
     pCompressed->Seek(0);
-    std::unique_ptr<SvStream> aDecompressed(new SvMemoryStream(4096, 4096));
+    std::unique_ptr<SvMemoryStream> aDecompressed(new SvMemoryStream(4096, 4096));
     unsigned char buffer[512];
     pCompressed->ReadBytes(buffer, 16);
     aDecompressed->WriteBytes(buffer, 16);
@@ -136,6 +136,9 @@ bool Decompress(SvStream *pCompressed, SvStream * & pOutDecompressed)
     while (sal_uInt32 iRead = pCompressed->ReadBytes(buffer, 512))
         aDecompressed->WriteBytes(buffer, iRead);
 
+    // disable stream growing past its current size
+    aDecompressed->SetResizeOffset(0);
+
     //transfer ownership of aDecompressed's ptr
     pOutDecompressed = aDecompressed.release();
     return true;
commit b2a76e663f68a3f377630c925ba61981105b9f48
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 1 13:19:31 2017 +0000

    move SvtLinguOptions into SmDocShell
    
    Change-Id: I46b84ab4cb9cc5d25b6cb60241fcc8a65e449886

diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index 756fc0f..83cda04 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -29,6 +29,7 @@
 #include <vcl/jobset.hxx>
 #include <vcl/virdev.hxx>
 #include <sax/fshelper.hxx>
+#include <unotools/lingucfg.hxx>
 #include <oox/core/filterbase.hxx>
 #include <oox/mathml/import.hxx>
 #include <oox/export/utils.hxx>
@@ -65,7 +66,6 @@ class SmCursor;
 class SmDocShell;
 class EditEngine;
 
-
 class SmPrinterAccess
 {
     VclPtr<Printer> pPrinter;
@@ -77,9 +77,7 @@ public:
     OutputDevice* GetRefDev()  { return pRefDev.get(); }
 };
 
-
-void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool);
-
+void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool, const SvtLinguOptions &rOpt);
 
 class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener
 {
@@ -90,6 +88,7 @@ class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener
     SmFormat            maFormat;
     SmParser            maParser;
     OUString            maAccText;
+    SvtLinguOptions     maLinguOptions;
     SmTableNode        *mpTree;
     SfxItemPool        *mpEditEngineItemPool;
     EditEngine         *mpEditEngine;
@@ -188,6 +187,7 @@ public:
 
     EditEngine &    GetEditEngine();
     SfxItemPool &   GetEditEngineItemPool();
+    const SvtLinguOptions & GetLinguOptions() const { return maLinguOptions; }
 
     void        DrawFormula(OutputDevice &rDev, Point &rPosition, bool bDrawSelection = false);
     Size        GetSize();
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 3e2bf42..a07c39f 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -46,7 +46,6 @@
 #include <svl/fstathelper.hxx>
 #include <svl/intitem.hxx>
 #include <svl/itempool.hxx>
-#include <unotools/lingucfg.hxx>
 #include <unotools/linguprops.hxx>
 #include <unotools/pathoptions.hxx>
 #include <svl/ptitem.hxx>
@@ -287,12 +286,9 @@ void SmDocShell::ArrangeFormula()
     maAccText.clear();
 }
 
-void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool)
+void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool, const SvtLinguOptions &rOpt)
 {
     // set fonts to be used
-    SvtLinguOptions aOpt;
-    SvtLinguConfig().GetOptions( aOpt );
-
     struct FontDta {
         sal_Int16       nFallbackLang;
         sal_Int16       nLang;
@@ -310,9 +306,9 @@ void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool)
         {   LANGUAGE_ARABIC_SAUDI_ARABIA,  LANGUAGE_NONE,
             DefaultFontType::CTL_TEXT,   EE_CHAR_FONTINFO_CTL }
     };
-    aTable[0].nLang = aOpt.nDefaultLanguage;
-    aTable[1].nLang = aOpt.nDefaultLanguage_CJK;
-    aTable[2].nLang = aOpt.nDefaultLanguage_CTL;
+    aTable[0].nLang = rOpt.nDefaultLanguage;
+    aTable[1].nLang = rOpt.nDefaultLanguage_CJK;
+    aTable[2].nLang = rOpt.nDefaultLanguage_CTL;
 
     for (FontDta & rFntDta : aTable)
     {
@@ -348,7 +344,7 @@ EditEngine& SmDocShell::GetEditEngine()
 
         mpEditEngineItemPool = EditEngine::CreatePool();
 
-        SetEditEngineDefaultFonts(*mpEditEngineItemPool);
+        SetEditEngineDefaultFonts(*mpEditEngineItemPool, maLinguOptions);
 
         mpEditEngine = new EditEngine( mpEditEngineItemPool );
 
@@ -640,6 +636,8 @@ SmDocShell::SmDocShell( SfxModelFlags i_nSfxCreationFlags )
     , mnModifyCount(0)
     , mbFormulaArranged(false)
 {
+    SvtLinguConfig().GetOptions(maLinguOptions);
+
     SetPool(&SfxGetpApp()->GetPool());
 
     SmModule *pp = SM_MOD();
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 89275bb..ac32445 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -230,7 +230,7 @@ void SmEditWindow::DataChanged( const DataChangedEvent& )
 
         pEditEngine->SetDefTab(sal_uInt16(GetTextWidth("XXXX")));
 
-        SetEditEngineDefaultFonts(pDoc->GetEditEngineItemPool());
+        SetEditEngineDefaultFonts(pDoc->GetEditEngineItemPool(), pDoc->GetLinguOptions());
 
         // forces new settings to be used
         // unfortunately this resets the whole edit engine


More information about the Libreoffice-commits mailing list