[Libreoffice-commits] core.git: 2 commits - winaccessibility/source xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Oct 20 17:53:47 UTC 2018


 winaccessibility/source/UAccCOM/MAccessible.cxx |    7 +++++--
 xmloff/source/style/numehelp.cxx                |   14 ++++----------
 2 files changed, 9 insertions(+), 12 deletions(-)

New commits:
commit f90c2001eb8f6d41e90fa347bf5a707bbefb6f43
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 19 16:55:19 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Oct 20 19:53:39 2018 +0200

    pvs-studio: Expression '!bWasSetTypeAttribute' is always true.
    
    Change-Id: I605bbc117426bba3dae9a8ec3ffc45967edbf7c4
    Reviewed-on: https://gerrit.libreoffice.org/62060
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/xmloff/source/style/numehelp.cxx b/xmloff/source/style/numehelp.cxx
index b678d559a277..db9e1d8dac6e 100644
--- a/xmloff/source/style/numehelp.cxx
+++ b/xmloff/source/style/numehelp.cxx
@@ -105,11 +105,8 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes(SvXMLExport& rXMLExp
     case util::NumberFormat::SCIENTIFIC:
     case util::NumberFormat::FRACTION:
         {
-            if (!bWasSetTypeAttribute)
-            {
-                rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT);
-                bWasSetTypeAttribute = true;
-            }
+            rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT);
+            bWasSetTypeAttribute = true;
             SAL_FALLTHROUGH;
         }
     case util::NumberFormat::PERCENT:
@@ -374,11 +371,8 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes(
     case util::NumberFormat::SCIENTIFIC:
     case util::NumberFormat::FRACTION:
         {
-            if (!bWasSetTypeAttribute)
-            {
-                pExport->AddAttribute(sAttrValType, XML_FLOAT);
-                bWasSetTypeAttribute = true;
-            }
+            pExport->AddAttribute(sAttrValType, XML_FLOAT);
+            bWasSetTypeAttribute = true;
             SAL_FALLTHROUGH;
         }
     case util::NumberFormat::PERCENT:
commit c2b33fec70f0f4c79584db119ecd565af3a5b28e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 19 17:22:42 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Oct 20 19:53:27 2018 +0200

    pvs-studio: 'memcpy' function will lead to underflow of the buffer
    
    Change-Id: I285d5ddcc8906d1e38c6b58c625dc7c894ad433a
    Reviewed-on: https://gerrit.libreoffice.org/62064
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
index 0a75d9a4e5a8..1801cf61929e 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -2898,10 +2898,13 @@ void CMAccessible::ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pv
             break;
 
         case TypeClass_BOOLEAN:
+        {
+            bool bBoolean(false);
+            rAnyVal >>= bBoolean;
             pvData->vt = VT_BOOL;
-            memcpy(&pvData->boolVal, rAnyVal.getValue(), sizeof(sal_Bool));
+            pvData->boolVal = bBoolean; // boolVal is a VARIANT_BOOL, a 16bit field
             break;
-
+        }
         case TypeClass_BYTE:
             pvData->vt = VT_UI1;
             memcpy(&pvData->bVal, rAnyVal.getValue(), sizeof(sal_Int8));


More information about the Libreoffice-commits mailing list