[Libreoffice-commits] core.git: 2 commits - comphelper/source sd/source

Caolán McNamara caolanm at redhat.com
Tue Jan 30 11:35:40 UTC 2018


 comphelper/source/misc/lok.cxx |    1 +
 sd/source/ui/view/drviews2.cxx |   20 +++++++++-----------
 sd/source/ui/view/outlnvs2.cxx |   20 +++++++++-----------
 3 files changed, 19 insertions(+), 22 deletions(-)

New commits:
commit c02f1e27934a29bc2d89ed34be8fa4d755d93de0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 30 11:31:55 2018 +0000

    silence coverity#1428735 Use of untrusted scalar value
    
    Change-Id: I7e40f25ce506b1a26d683848a1bc83c16baf762f

diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index 589f57b61bce..203426bdc691 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -123,6 +123,7 @@ bool isWhitelistedLanguage(const OUString& lang)
     static std::vector<OUString> aWhitelist;
     if (!bInitialized)
     {
+        // coverity[tainted_data] - we trust the contents of this variable
         const char* pWhitelist = getenv("LOK_WHITELIST_LANGUAGES");
         if (pWhitelist)
         {
commit 9a5140befbd7b9ae4118c5899ed8595d5abb65f8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 30 11:28:22 2018 +0000

    coverity#1428736 Dereference null return value
    
    and
    
    coverity#1428737 Dereference null return value
    
    Change-Id: Ia743107e194a7945be1eb3ab521ef7fe1a168ab3

diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index c6c29dbce508..9271c6fd0574 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -882,20 +882,18 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         {
             const SfxItemSet* pArgs = rReq.GetArgs();
 
-            if (pArgs && pArgs->Count () == 1 )
+            const SfxUInt16Item* pScale = (pArgs && pArgs->Count () == 1) ?
+                rReq.GetArg<SfxUInt16Item>(SID_ATTR_ZOOMSLIDER) : nullptr;
+            if (pScale && CHECK_RANGE (5, pScale->GetValue (), 3000))
             {
-                const SfxUInt16Item* pScale = rReq.GetArg<SfxUInt16Item>(SID_ATTR_ZOOMSLIDER);
-                if (CHECK_RANGE (5, pScale->GetValue (), 3000))
-                {
-                    SetZoom (pScale->GetValue ());
+                SetZoom (pScale->GetValue ());
 
-                    SfxBindings& rBindings = GetViewFrame()->GetBindings();
-                    rBindings.Invalidate( SID_ATTR_ZOOM );
-                    rBindings.Invalidate( SID_ZOOM_IN );
-                    rBindings.Invalidate( SID_ZOOM_OUT );
-                    rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
+                SfxBindings& rBindings = GetViewFrame()->GetBindings();
+                rBindings.Invalidate( SID_ATTR_ZOOM );
+                rBindings.Invalidate( SID_ZOOM_IN );
+                rBindings.Invalidate( SID_ZOOM_OUT );
+                rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
 
-                }
             }
 
             Cancel();
diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx
index ff5c9767d478..9400154d44a2 100644
--- a/sd/source/ui/view/outlnvs2.cxx
+++ b/sd/source/ui/view/outlnvs2.cxx
@@ -117,20 +117,18 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq)
         {
             const SfxItemSet* pArgs = rReq.GetArgs();
 
-            if (pArgs && pArgs->Count () == 1 )
+            const SfxUInt16Item* pScale = (pArgs && pArgs->Count () == 1) ?
+                rReq.GetArg<SfxUInt16Item>(SID_ATTR_ZOOMSLIDER) : nullptr;
+            if (pScale && CHECK_RANGE (5, pScale->GetValue (), 3000))
             {
-                const SfxUInt16Item* pScale = rReq.GetArg<SfxUInt16Item>(SID_ATTR_ZOOMSLIDER);
-                if (CHECK_RANGE (5, pScale->GetValue (), 3000))
-                {
-                    SetZoom (pScale->GetValue ());
+                SetZoom (pScale->GetValue ());
 
-                    SfxBindings& rBindings = GetViewFrame()->GetBindings();
-                    rBindings.Invalidate( SID_ATTR_ZOOM );
-                    rBindings.Invalidate( SID_ZOOM_IN );
-                    rBindings.Invalidate( SID_ZOOM_OUT );
-                    rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
+                SfxBindings& rBindings = GetViewFrame()->GetBindings();
+                rBindings.Invalidate( SID_ATTR_ZOOM );
+                rBindings.Invalidate( SID_ZOOM_IN );
+                rBindings.Invalidate( SID_ZOOM_OUT );
+                rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
 
-                }
             }
 
             Cancel();


More information about the Libreoffice-commits mailing list