[Libreoffice-commits] core.git: 11 commits - filter/source package/source starmath/source sw/source writerfilter/source

Caolán McNamara caolanm at redhat.com
Fri Mar 21 01:55:17 PDT 2014


 filter/source/flash/swfwriter1.cxx                |    2 ++
 package/source/zipapi/ZipFile.cxx                 |   13 ++++++-------
 package/source/zipapi/ZipOutputStream.cxx         |    2 ++
 starmath/source/cursor.cxx                        |    5 +++++
 sw/source/core/frmedt/fetab.cxx                   |    4 ++--
 sw/source/core/txtnode/ndtxt.cxx                  |   10 +++++++++-
 sw/source/filter/ww8/ww8par5.cxx                  |    2 +-
 sw/source/ui/frmdlg/frmpage.cxx                   |    3 +--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    2 ++
 9 files changed, 30 insertions(+), 13 deletions(-)

New commits:
commit 52cc0c8f05d40db6d076c13f8b8d6d9453ec8930
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 20:54:31 2014 +0000

    coverity#982784 Unintentional integer overflow
    
    Change-Id: Ib50e0987adf419ecdd569fc5dd5c8b2b1e246e2f

diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 7255185..83505e2 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -1072,16 +1072,15 @@ sal_Int32 ZipFile::getCRC( sal_Int64 nOffset, sal_Int64 nSize )
 
     Sequence < sal_Int8 > aBuffer;
     CRC32 aCRC;
-    sal_Int32 nBlockSize = static_cast< sal_Int32 > (::std::min( nSize, static_cast< sal_Int64 >( 32000 ) ) );
+    sal_Int64 nBlockSize = ::std::min(nSize, static_cast< sal_Int64 >(32000));
 
     aGrabber.seek( nOffset );
-    for ( int ind = 0;
-          aGrabber.readBytes( aBuffer, nBlockSize ) && ind * nBlockSize < nSize;
-          ind++ )
+    for (sal_Int64 ind = 0;
+         aGrabber.readBytes( aBuffer, nBlockSize ) && ind * nBlockSize < nSize;
+         ++ind)
     {
-        sal_Int64 nLen = ::std::min( static_cast< sal_Int64 >( nBlockSize ),
-                                     nSize - ind * nBlockSize );
-        aCRC.updateSegment( aBuffer, 0, static_cast< sal_Int32 >( nLen ) );
+        sal_Int64 nLen = ::std::min(nBlockSize, nSize - ind * nBlockSize);
+        aCRC.updateSegment(aBuffer, 0, static_cast<sal_Int32>(nLen));
     }
 
     return aCRC.getValue();
commit 16b6b45e8ca1e727694a52525cf35782c0d69978
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 20:47:10 2014 +0000

    coverity#707964 Uninitialized scalar field
    
    Change-Id: I051e5ae4200563426d810e9a4d94ab02fb8ccf51

diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx
index 14c5f57..e9f1b65 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -48,6 +48,8 @@ ZipOutputStream::ZipOutputStream( const uno::Reference< uno::XComponentContext >
 , aChucker(xOStream)
 , pCurrentEntry(NULL)
 , nMethod(DEFLATED)
+, nLevel(0)
+, mnDigested(0)
 , bFinished(sal_False)
 , bEncryptCurrentEntry(sal_False)
 , m_pCurrentStream(NULL)
commit 383dbc04ee65b60e7946893614a6e6bb80981599
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 16:52:22 2014 +0000

    coverity#705160 Missing break in switch
    
    Change-Id: I7be86ec16743dd8342cd82c9fcd089cb36d668ce

diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
index 754f876..4a67720 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -1803,7 +1803,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
                 const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pAction;
                 clipRect = pA->GetRect();
             }
-            //fall-through
+            // fall-through
             case( META_CLIPREGION_ACTION ):
             case( META_ISECTREGIONCLIPREGION_ACTION ):
             case( META_MOVECLIPREGION_ACTION ):
@@ -1816,6 +1816,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
             {
                 bMap++;
             }
+            // fall-through
             case( META_REFPOINT_ACTION ):
             case( META_LINECOLOR_ACTION ):
             case( META_FILLCOLOR_ACTION ):
commit bb7d4a00941bc4394b35e79545ab48fb345b7bf9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 16:51:10 2014 +0000

    coverity#705159 Missing break in switch
    
    Change-Id: I61975ae42519d2fc9e0074a32ad2a504c6821641

diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
index 0d7b7b0..754f876 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -1803,6 +1803,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
                 const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pAction;
                 clipRect = pA->GetRect();
             }
+            //fall-through
             case( META_CLIPREGION_ACTION ):
             case( META_ISECTREGIONCLIPREGION_ACTION ):
             case( META_MOVECLIPREGION_ACTION ):
commit 46c95fa7407df716795d4350506d57b2ed1fb11d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 16:47:49 2014 +0000

    coverity#736099 Improper use of negative value
    
    Change-Id: I065a8074fcafba123898c70eded464aa108e2e9e

diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index d05a1b8..5b98476 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -302,6 +302,11 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){
     SmStructureNode* pLineParent = pLine->GetParent();
     int nParentIndex = pLineParent->IndexOfSubNode(pLine);
     OSL_ENSURE(nParentIndex != -1, "pLine must be a subnode of pLineParent!");
+    if (nParentIndex == -1)
+    {
+        delete pNewNodes;
+        return;
+    }
 
     //Convert line to list
     SmNodeList* pLineList = NodeToList(pLine);
commit 84c4838febc60af47f61795d3ca0884edb39f0e4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 16:44:01 2014 +0000

    coverity#705442 Improper use of negative value
    
    Change-Id: If039b52c96fd9c902f72c17b13442ddd7f68f13f

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index a5c954b..aa0896a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2070,6 +2070,8 @@ OUString lcl_ExctractAskVariableAndHint( const OUString& rCommand, OUString& rHi
     // if no hint is set the variable is used as hint
     // the quotes of the hint have to be removed
     sal_Int32 nIndex = rCommand.indexOf( ' ', 2); //find last space after 'ASK'
+    if (nIndex == -1)
+        return OUString();
     while(rCommand[nIndex] == ' ')
         ++nIndex;
     OUString sShortCommand( rCommand.copy( nIndex ) ); //cut off the " ASK "
commit ee948846df6e880e7b421e0ef36367849ae0004e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 16:41:29 2014 +0000

    coverity#705430 Improper use of negative value
    
    Change-Id: Ia97bc71328d095f7f36d1d53027bd2bb16a9a60f

diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index e866049..e212d55 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2996,7 +2996,15 @@ long SwTxtNode::GetLeftMarginForTabCalculation() const
     const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0;
     if( pRule )
     {
-        const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(GetActualListLevel()));
+        int nLevel = GetActualListLevel();
+
+        if (nLevel < 0)
+            nLevel = 0;
+
+        if (nLevel >= MAXLEVEL)
+            nLevel = MAXLEVEL - 1;
+
+        const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(nLevel));
         if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
         {
             if ( AreListLevelIndentsApplicable() )
commit a0245173b0352e0032013b39b124a02c76d23786
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 16:36:23 2014 +0000

    coverity#705951 Dereference before null check
    
    Change-Id: I457c7787378dad1cceccb9e5f84786575a6e2cd8

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 3150515..7c37324 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1772,8 +1772,7 @@ IMPL_LINK( SwFrmPage, RelSizeClickHdl, CheckBox *, pBtn )
             m_aHeightED.get()->SetMax(MAX_PERCENT_HEIGHT);
     }
 
-    if (pBtn)   // only when Handler was called by change of the controller
-        RangeModifyHdl(m_aWidthED.get());  // correct the values again
+    RangeModifyHdl(m_aWidthED.get());  // correct the values again
 
     if (pBtn == m_pRelWidthCB)
         ModifyHdl(m_aWidthED.get());
commit 9a973579bc27634d050cccb11460ea7070df2e18
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 16:34:01 2014 +0000

    coverity#705940 Dereference before null check
    
    Change-Id: Ib47e07a7b37917e68c5b49b49254b38976bd497e

diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 040e3e1..eb09b7b 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -850,7 +850,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes)
     }
 
     //Only one type of field (hyperlink) in drawing textboxes exists
-    if (aF.nId != 88 && pPlcxMan && pPlcxMan->GetDoingDrawTextBox())
+    if (aF.nId != 88 && pPlcxMan->GetDoingDrawTextBox())
         return aF.nLen;
 
     // keine Routine vorhanden
commit 4bd3c28b0b9ba1563efec7dba01b2b6d8e9a546e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 16:32:25 2014 +0000

    coverity#705920 Dereference before null check
    
    Change-Id: I2b6cbd482a13b026c6fe1caa8a115b90ef62b1c4

diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index fc9fc2f..dcf268a 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1969,7 +1969,7 @@ sal_uInt8 SwFEShell::WhichMouseTabCol( const Point &rPt ) const
 
     if( pFrm )
     {
-        while( pFrm->Lower() && pFrm->Lower()->IsRowFrm() )
+        while( pFrm && pFrm->Lower() && pFrm->Lower()->IsRowFrm() )
             pFrm = (SwCellFrm*)((SwLayoutFrm*)pFrm->Lower())->Lower();
         if( pFrm && pFrm->GetTabBox()->GetSttNd() &&
             pFrm->GetTabBox()->GetSttNd()->IsInProtectSect() )
commit 38523b4a0ef994976883b5339cf5b29d7f7d64ba
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 20 16:31:48 2014 +0000

    coverity#705919 Dereference before null check
    
    Change-Id: I3bd5c35e6c9dcee0833dd3f5b15dec064b525d0a

diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index ce83786..fc9fc2f 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1848,7 +1848,7 @@ bool SwFEShell::SelTblRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag
 
         if( pFrm )
         {
-            while( pFrm->Lower() && pFrm->Lower()->IsRowFrm() )
+            while( pFrm && pFrm->Lower() && pFrm->Lower()->IsRowFrm() )
                 pFrm = static_cast<const SwCellFrm*>( static_cast<const SwLayoutFrm*>( pFrm->Lower() )->Lower() );
             if( pFrm && pFrm->GetTabBox()->GetSttNd() &&
                 pFrm->GetTabBox()->GetSttNd()->IsInProtectSect() )


More information about the Libreoffice-commits mailing list