[Libreoffice-commits] core.git: 3 commits - o3tl/qa sd/source vcl/source

Caolán McNamara caolanm at redhat.com
Tue Jan 24 09:10:40 UTC 2017


 o3tl/qa/cow_wrapper_clients.hxx |   14 +++++---------
 sd/source/ui/unoidl/unopage.cxx |    2 +-
 vcl/source/filter/sgfbram.cxx   |    3 ++-
 3 files changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 06202a90d6857a66512e10fef771b36196fc2d03
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 24 09:07:35 2017 +0000

    coverity#1399266 Uncaught exception
    
    Change-Id: I1066fda2258e6acbbbad23256f815975564e5e61

diff --git a/o3tl/qa/cow_wrapper_clients.hxx b/o3tl/qa/cow_wrapper_clients.hxx
index 138f496..7750b71 100644
--- a/o3tl/qa/cow_wrapper_clients.hxx
+++ b/o3tl/qa/cow_wrapper_clients.hxx
@@ -22,6 +22,7 @@
 
 #include "o3tl/cow_wrapper.hxx"
 #include "cppunit/extensions/HelperMacros.h"
+#include <assert.h>
 
 /* Definition of Cow_Wrapper_Clients classes */
 
@@ -153,15 +154,12 @@ struct BogusRefCountPolicy
     static sal_uInt32 s_nEndOfScope;
     typedef sal_uInt32 ref_count_t;
     static void incrementCount( ref_count_t& rCount ) {
-        if(s_bShouldIncrement)
-        {
-            ++rCount;
-            s_bShouldIncrement = false;
-        }
-        else
-            CPPUNIT_FAIL("Ref-counting policy incremented when it should not have.");
+        assert(s_bShouldIncrement && "Ref-counting policy incremented when it should not have.");
+        ++rCount;
+        s_bShouldIncrement = false;
     }
     static bool decrementCount( ref_count_t& rCount ) {
+        assert((s_nEndOfScope || s_bShouldDecrement) && "Ref-counting policy decremented when it should not have.");
         if(s_nEndOfScope)
         {
             --rCount;
@@ -172,8 +170,6 @@ struct BogusRefCountPolicy
             --rCount;
             s_bShouldDecrement = false;
         }
-        else
-            CPPUNIT_FAIL("Ref-counting policy decremented when it should not have.");
         return rCount != 0;
     }
 };
commit b13b78a9067e069886379deec9cb3eaa1d85f91e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 24 08:58:49 2017 +0000

    coverity#1399552 Unintended sign extension
    
    and
    
    coverity#1399551 Unintended sign extension
    
    Change-Id: Iedf7edf35f8b7985860fc254597776fbc1f561f5

diff --git a/vcl/source/filter/sgfbram.cxx b/vcl/source/filter/sgfbram.cxx
index e25d01f..335ee70 100644
--- a/vcl/source/filter/sgfbram.cxx
+++ b/vcl/source/filter/sgfbram.cxx
@@ -294,7 +294,8 @@ bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&)
         //we're going to loop Ysize * XSize on GetByte, max compression for GetByte is a run of 63
         //if we're less than that (and add a generous amount of wriggle room) then its not going
         //to fly
-        const sal_uInt64 nMinBytesPossiblyNeeded = rHead.Xsize * rHead.Ysize / 128;
+        sal_uInt64 nMinBytesPossiblyNeeded = rHead.Xsize;
+        nMinBytesPossiblyNeeded *= rHead.Ysize / 128;
         if (rInp.remainingSize() < nMinBytesPossiblyNeeded)
             return false;
 
commit 86895c6d30d3b34375ce81e60f0db1de250f3841
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 24 08:52:53 2017 +0000

    coverity#1399550 Dereference after null check
    
    Change-Id: I4a1ba212b64c7b561f0c1b1f7f75fe255c8d1415

diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 52cbf5b..80b820a 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2703,7 +2703,7 @@ Any SdGenericDrawPage::getNavigationOrder()
 
 // class SdMasterPage
 SdMasterPage::SdMasterPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
-: SdGenericDrawPage( pModel, pPage, ImplGetMasterPagePropertySet( pPage ? pPage->GetPageKind() : PageKind::Standard ) )
+    : SdGenericDrawPage(pModel, pPage, ImplGetMasterPagePropertySet(pPage->GetPageKind()))
 {
 }
 


More information about the Libreoffice-commits mailing list