[Libreoffice-commits] core.git: 3 commits - include/o3tl sccomp/source sd/source sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sun Jun 20 13:20:27 UTC 2021
include/o3tl/deleter.hxx | 49 ++++++++++++++++++++---------------
sccomp/source/solver/SwarmSolver.cxx | 2 -
sd/source/ui/view/sdview.cxx | 5 ++-
sw/source/core/undo/undobj.cxx | 4 ++
sw/source/uibase/uno/unoatxt.cxx | 4 ++
5 files changed, 38 insertions(+), 26 deletions(-)
New commits:
commit 6c7075ee60e799db8b8f94a6d0317ad9bcb75b5d
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Jun 19 21:32:12 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Jun 20 15:17:25 2021 +0200
cid#1485150 suppress Uncaught exception
Change-Id: Ic1b2a44afd15e0720edd48f3502dd2799795551a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117508
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/o3tl/deleter.hxx b/include/o3tl/deleter.hxx
index 7cb9145eb2a1..ed8b1a583094 100644
--- a/include/o3tl/deleter.hxx
+++ b/include/o3tl/deleter.hxx
@@ -17,6 +17,33 @@
#include <com/sun/star/uno/Exception.hpp>
#include <sal/log.hxx>
+#if defined(__COVERITY__)
+#define suppress_fun_call_w_exception(expr) \
+ do \
+ { \
+ try \
+ { \
+ expr; \
+ } \
+ catch (const css::uno::Exception& ex) \
+ { \
+ SAL_WARN("vcl.app", "Fatal exception: " << exceptionToString(ex)); \
+ std::terminate(); \
+ } \
+ catch (const std::exception& e) \
+ { \
+ SAL_WARN("vcl.app", "Fatal exception: " << e.what()); \
+ std::terminate(); \
+ } \
+ } while (false)
+#else
+#define suppress_fun_call_w_exception(expr) \
+ do \
+ { \
+ expr; \
+ } while (false)
+#endif
+
namespace o3tl
{
/** To markup std::unique_ptr that coverity warns might throw exceptions
@@ -25,27 +52,7 @@ namespace o3tl
*/
template <typename T> struct default_delete
{
- void operator()(T* p) noexcept
- {
-#if defined(__COVERITY__)
- try
- {
- delete p;
- }
- catch (const css::uno::Exception& ex)
- {
- SAL_WARN("vcl.app", "Fatal exception: " << exceptionToString(ex));
- std::terminate();
- }
- catch (const std::exception& e)
- {
- SAL_WARN("vcl.app", "Fatal exception: " << e.what());
- std::terminate();
- }
-#else
- delete p;
-#endif
- }
+ void operator()(T* p) noexcept { suppress_fun_call_w_exception(delete p); }
};
struct free_delete
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 3f3120606776..8470118e6ceb 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -24,6 +24,7 @@
#include <View.hxx>
#include <editeng/outlobj.hxx>
#include <editeng/unolingu.hxx>
+#include <o3tl/deleter.hxx>
#include <svx/obj3d.hxx>
#include <svx/fmview.hxx>
#include <editeng/outliner.hxx>
@@ -145,8 +146,8 @@ View::~View()
while(PaintWindowCount())
{
// remove all registered OutDevs
- // coverity[fun_call_w_exception : SUPPRESS] - cid#485150 silence Uncaught exception
- DeleteWindowFromPaintView(GetFirstOutputDevice() /*GetWin(0)*/);
+ // cid#1485150 silence Uncaught exception
+ suppress_fun_call_w_exception(DeleteWindowFromPaintView(GetFirstOutputDevice()));
}
}
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 5c2405f32966..02d2a5327c38 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -42,6 +42,7 @@
#include <docsh.hxx>
#include <view.hxx>
#include <frameformats.hxx>
+#include <o3tl/deleter.hxx>
#include <sal/log.hxx>
// This class saves the Pam as integers and can recompose those into a PaM
@@ -1208,7 +1209,8 @@ SwUndoSaveSection::~SwUndoSaveSection()
{
// SaveSection saves the content in the PostIt section.
SwNodes& rUNds = m_pMovedStart->GetNode().GetNodes();
- rUNds.Delete( *m_pMovedStart, m_nMoveLen );
+ // cid#1486004 Uncaught exception
+ suppress_fun_call_w_exception(rUNds.Delete(*m_pMovedStart, m_nMoveLen));
m_pMovedStart.reset();
}
commit 92741976101e8224291cf9af492209ff5412ca7b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Jun 19 21:03:46 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Jun 20 15:17:03 2021 +0200
cid#1486006 help coverity see that pGlossaries won't be null
Change-Id: I0f0e8e5ac0169090cd1f99c8aa6bf16b1edf8a85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117506
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index 45f12f7b5b10..c5689f63a747 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -491,7 +491,9 @@ sal_Int32 SwXAutoTextGroup::getCount()
uno::Any SwXAutoTextGroup::getByIndex(sal_Int32 nIndex)
{
SolarMutexGuard aGuard;
- std::unique_ptr<SwTextBlocks> pGlosGroup(pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
+ if (!pGlossaries)
+ throw uno::RuntimeException();
+ std::unique_ptr<SwTextBlocks> pGlosGroup(pGlossaries->GetGroupDoc(m_sGroupName));
if (!pGlosGroup || pGlosGroup->GetError())
throw uno::RuntimeException();
const sal_uInt16 nCount = pGlosGroup->GetCount();
commit 999136c0d0a9964b4db40123e81aaf78229d10c3
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Jun 19 20:59:34 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Jun 20 15:16:42 2021 +0200
cid#1486008 Explicit null dereferenced
since...
commit 0771ac00acc8730f77db76b901724f1513a32723
Date: Tue Jun 15 21:12:25 2021 +0200
use string_view in the Translate API
Change-Id: Icb069f3662f5899e404784909d06088d88eabd78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117505
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sccomp/source/solver/SwarmSolver.cxx b/sccomp/source/solver/SwarmSolver.cxx
index 515beaed0d51..5ebeedfc032c 100644
--- a/sccomp/source/solver/SwarmSolver.cxx
+++ b/sccomp/source/solver/SwarmSolver.cxx
@@ -233,7 +233,7 @@ public:
virtual OUString SAL_CALL getPropertyDescription(const OUString& rPropertyName) override
{
- const char* pResId = nullptr;
+ const char* pResId = "";
switch (getInfoHelper().getHandleByName(rPropertyName))
{
case PROP_NONNEGATIVE:
More information about the Libreoffice-commits
mailing list