[Libreoffice-commits] core.git: 6 commits - helpcompiler/source sc/source sd/inc sd/source svl/source svx/source

Caolán McNamara caolanm at redhat.com
Mon Dec 15 01:33:49 PST 2014


 helpcompiler/source/HelpCompiler.cxx          |   18 ++++++++--------
 sc/source/filter/lotus/tool.cxx               |    4 +++
 sc/source/filter/starcalc/scflt.cxx           |    3 +-
 sd/inc/sdundo.hxx                             |    2 -
 sd/source/ui/view/drviews3.cxx                |   28 +++++++++++++-------------
 svl/source/items/poolio.cxx                   |    7 ++++++
 svx/source/sidebar/area/AreaPropertyPanel.cxx |    3 --
 7 files changed, 39 insertions(+), 26 deletions(-)

New commits:
commit 52a242e5bccc4307a1adcff093cfd4df7e6af101
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:28:51 2014 +0000

    coverity#704777 Explicit null dereferenced
    
    Change-Id: Ia9a3a45183b7aa8367b3146061bde5036bcd8cfe

diff --git a/sd/inc/sdundo.hxx b/sd/inc/sdundo.hxx
index 7563640..60bb645 100644
--- a/sd/inc/sdundo.hxx
+++ b/sd/inc/sdundo.hxx
@@ -33,7 +33,7 @@ public:
                                 : mpDoc(pSdDrawDocument)  {}
     virtual                 ~SdUndoAction() {}
 
-    void                    SetComment(OUString& rStr) { maComment = rStr; }
+    void                    SetComment(const OUString& rStr) { maComment = rStr; }
     virtual OUString        GetComment() const SAL_OVERRIDE { return maComment; }
     virtual SdUndoAction*   Clone() const { return NULL; }
 
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 6152834..c5da809 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -492,20 +492,14 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
     const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
     Size aPageSize = mpActualPage->GetSize();
     Size aViewSize = GetActiveWindow()->GetViewSize();
-    SdUndoGroup* pUndoGroup = NULL;
-
-    if ( rReq.GetSlot() == SID_ATTR_LONG_LRSPACE ||
-         rReq.GetSlot() == SID_ATTR_LONG_ULSPACE )
-    {
-        pUndoGroup = new SdUndoGroup(GetDoc());
-        OUString aString(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
-        pUndoGroup->SetComment(aString);
-    }
 
     switch ( rReq.GetSlot() )
     {
         case SID_ATTR_LONG_LRSPACE:
         {
+            SdUndoGroup* pUndoGroup = new SdUndoGroup(GetDoc());
+            pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
+
             const SvxLongLRSpaceItem& rLRSpace = static_cast<const SvxLongLRSpaceItem&>(
                     pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE)));
 
@@ -559,10 +553,17 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                 }
                 InvalidateWindows();
             }
+
+            // give the undo group to the undo manager
+            GetViewFrame()->GetObjectShell()->GetUndoManager()->
+                                                AddUndoAction(pUndoGroup);
             break;
         }
         case SID_ATTR_LONG_ULSPACE:
         {
+            SdUndoGroup* pUndoGroup = new SdUndoGroup(GetDoc());
+            pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
+
             const SvxLongULSpaceItem& rULSpace = static_cast<const SvxLongULSpaceItem&>(
                     pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE)));
 
@@ -617,6 +618,11 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                 }
                 InvalidateWindows();
             }
+
+            // give the undo group to the undo manager
+            GetViewFrame()->GetObjectShell()->GetUndoManager()->
+                                                AddUndoAction(pUndoGroup);
+
             break;
         }
 
@@ -846,10 +852,6 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
             break;
         }
     }
-    if ( pUndoGroup )
-        // give the undo group to the undo manager
-        GetViewFrame()->GetObjectShell()->GetUndoManager()->
-                                            AddUndoAction(pUndoGroup);
 }
 
 void  DrawViewShell::GetRulerState(SfxItemSet& rSet)
commit d03d1ad55e0ef37d922aa88a7ed23ed4f7fdca02
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:22:15 2014 +0000

    coverity#704150 Resource leak in object
    
    and
    
    coverity#704151 Resource leak in object
    coverity#704152 Resource leak in object
    
    Change-Id: I68c455adc25375b8027236fd44d99a397e372994

diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index a43864f..03cb4f4 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -247,9 +247,9 @@ public:
     std::string documentId;
     std::string fileName;
     std::string title;
-    HashSet *hidlist;
-    Hashtable *keywords;
-    Stringtable *helptexts;
+    std::unique_ptr<HashSet> hidlist;
+    std::unique_ptr<Hashtable> keywords;
+    std::unique_ptr<Stringtable> helptexts;
 private:
     HashSet extendedHelpText;
 public:
@@ -257,9 +257,9 @@ public:
         const std::string &intitle) : documentId(indocumentId), fileName(infileName),
         title(intitle)
     {
-        hidlist = new HashSet;
-        keywords = new Hashtable;
-        helptexts = new Stringtable;
+        hidlist.reset(new HashSet);
+        keywords.reset(new Hashtable);
+        helptexts.reset(new Stringtable);
     }
     void traverse( xmlNodePtr parentNode );
 private:
@@ -461,9 +461,9 @@ bool HelpCompiler::compile()
 
     streamTable.dropappl();
     streamTable.appl_doc = docResolvedDoc;
-    streamTable.appl_hidlist = aparser.hidlist;
-    streamTable.appl_helptexts = aparser.helptexts;
-    streamTable.appl_keywords = aparser.keywords;
+    streamTable.appl_hidlist = aparser.hidlist.release();
+    streamTable.appl_helptexts = aparser.helptexts.release();
+    streamTable.appl_keywords = aparser.keywords.release();
 
     streamTable.document_id = documentId;
     streamTable.document_path = fileName;
commit 002808e80f67839822a240b3c2a351b57248305a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:15:36 2014 +0000

    coverity#1242875 Untrusted loop bound
    
    Change-Id: I5ba34dca7d9f510981b85a35c056c792159f5f98

diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index 1ccba90..c3c97ae 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -580,6 +580,13 @@ SvStream &SfxItemPool::Load(SvStream &rStream)
             if ( nVerNo >= pImp->aVersions.size() )
             {
                 // Add new Version
+                const size_t nMaxRecords = rStream.remainingSize() / sizeof(sal_uInt16);
+                if (nCount > nMaxRecords)
+                {
+                    SAL_WARN("svl", "Parsing error: " << nMaxRecords <<
+                             " max possible entries, but " << nCount << " claimed, truncating");
+                    nCount = nMaxRecords;
+                }
                 sal_uInt16 *pMap = new sal_uInt16[nCount];
                 memset(pMap, 0, nCount * sizeof(sal_uInt16));
                 for ( sal_uInt16 n = 0; n < nCount; ++n )
commit c51500cb9b3fc15d371fb3f65b838ace5f126f3a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:13:22 2014 +0000

    coverity#1242937 Use of untrusted scalar value
    
    Change-Id: I0eeb35900b1c9c9fbd2889a653a3d042fb171bfd

diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index f09182c..4bb6655 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -77,6 +77,10 @@ void PutFormString(LotusContext& rContext, SCCOL nCol, SCROW nRow, SCTAB nTab, s
     if (!pString)
         return;
 
+    nCol = SanitizeCol(nCol);
+    nRow = SanitizeRow(nRow);
+    nTab = SanitizeTab(nTab);
+
     rContext.pDoc->ApplyAttr( nCol, nRow, nTab, *pJustify );
     ScSetStringParam aParam;
     aParam.setTextInput();
commit 3c4d0c4904867444454986b7d9aa0af64646572a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:12:04 2014 +0000

    coverity#1242939 Untrusted loop bound
    
    Change-Id: Id76a90cf61023fb2dbc276d54ab6f0ec63e25f9f

diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx
index 0355701..19ee464 100644
--- a/sc/source/filter/starcalc/scflt.cxx
+++ b/sc/source/filter/starcalc/scflt.cxx
@@ -2311,7 +2311,8 @@ void Sc10Import::LoadObjects()
         double nPPTY = ScGlobal::nScreenPPTY;
 
         long nStartX = 0;
-        for (SCsCOL nX=0; nX<GraphHeader.CarretX; nX++)
+        SCCOL nMaxCol = SanitizeCol(GraphHeader.CarretX);
+        for (SCCOL nX = 0; nX < nMaxCol; ++nX)
             nStartX += pDoc->GetColWidth(nX, static_cast<SCTAB>(GraphHeader.CarretZ));
         nStartX = (long) ( nStartX * HMM_PER_TWIPS );
         nStartX += (long) ( GraphHeader.x / nPPTX * HMM_PER_TWIPS );
commit f91e577ad81da79f0d8a92e02b9bdddce6dec85c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:09:10 2014 +0000

    coverity#1258449 Explicit null dereferenced
    
    Change-Id: I531a6ddd744f83ef345c0de8f8c112f61d56925e

diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx
index d95eaee..5f0d432 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -581,6 +581,7 @@ void AreaPropertyPanel::ImpUpdateTransparencies()
 
                 switch(rGradient.GetGradientStyle())
                 {
+                    default:
                     case css::awt::GradientStyle_LINEAR:
                     {
                         nEntryPos = 2;
@@ -617,8 +618,6 @@ void AreaPropertyPanel::ImpUpdateTransparencies()
                         pImage = &maImgSquare;
                         break;
                     }
-                    default:
-                        break;
                 }
 
                 const sal_uInt16 nIdGradient = mpBTNGradient->GetItemId(UNO_SIDEBARGRADIENT);


More information about the Libreoffice-commits mailing list