cui/source/options/optgdlg.cxx                      |    3 ++-
 include/o3tl/untaint.hxx                            |   16 ++++++++++------
 sd/source/ui/animations/CustomAnimationDialog.cxx   |    2 +-
 sd/source/ui/dlg/vectdlg.cxx                        |    3 ++-
 svx/source/sidebar/graphic/GraphicPropertyPanel.cxx |    7 ++++---
 sw/source/uibase/config/viewopt.cxx                 |    4 ++++
 6 files changed, 23 insertions(+), 12 deletions(-)

New commits:
commit b079066873babee7c4db1e4987b18ed107b49977
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Oct 25 14:58:08 2025 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Oct 25 20:19:45 2025 +0200

    ofz#455042527 Abrt
    
    This reverts commit 4ee667ebd3780bf646f11f8f1b78d4ed2c132432
    which was a poor thinko
    
    Change-Id: I671665ac3fe07c00c50bc9abf54b9a2622918b50
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192972
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 535260d7a443..5a2b5dcdbe90 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -573,12 +573,16 @@ rtl::Reference<comphelper::ConfigurationListener> const & 
getWCOptionListener()
 
 bool SwViewOption::IsIgnoreProtectedArea()
 {
+    if (comphelper::IsFuzzing())
+        return false;
     static comphelper::ConfigurationListenerProperty<bool> 
gIgnoreProtectedArea(getWCOptionListener(), u"IgnoreProtectedArea"_ustr);
     return gIgnoreProtectedArea.get();
 }
 
 bool SwViewOption::IsAllowDragDropText()
 {
+    if (comphelper::IsFuzzing())
+        return true;
     static comphelper::ConfigurationListenerProperty<bool> 
gAllowDragDrop(getWCOptionListener(), u"AllowDragDrop"_ustr);
     return gAllowDragDrop.get();
 }
commit 02490aa861889b5e23b0d88aceca2a709214c253
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Oct 20 09:19:18 2025 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Oct 25 20:19:38 2025 +0200

    cid#1667103 silence Overflowed constant
    
    and
    
    cid#1667099 Overflowed constant
    cid#1667098 Overflowed constant
    cid#1667074 Overflowed constant
    cid#1667065 Overflowed constant
    
    Change-Id: I293a09786e60313fdda45937d04e23557e47c0e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192971
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 78cf7a06bb56..731083412080 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <config_features.h>
+#include <o3tl/untaint.hxx>
 #include <svl/numformat.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/currencytable.hxx>
@@ -702,7 +703,7 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
 
     if (m_xAAPointLimit->get_value_changed_from_saved())
     {
-        sal_Int64 i = m_xAAPointLimit->get_value(FieldUnit::PIXEL);
+        sal_Int16 i = 
o3tl::sanitizing_cast<sal_Int16>(m_xAAPointLimit->get_value(FieldUnit::PIXEL));
         
officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::set(i, 
batch);
         bAppearanceChanged = true;
     }
diff --git a/include/o3tl/untaint.hxx b/include/o3tl/untaint.hxx
index 37632847039e..071637b68327 100644
--- a/include/o3tl/untaint.hxx
+++ b/include/o3tl/untaint.hxx
@@ -52,20 +52,24 @@ template <typename T>[[nodiscard]] inline T 
sanitizing_min(T a, T b) { return st
     return static_cast<unsigned short>(res);
 }
 
+// coverity[ -taint_source ]
+template <typename T1, typename T2> constexpr T1 sanitizing_cast(T2 value)
+{
+    assert(value >= std::numeric_limits<T1>::min() && value <= 
std::numeric_limits<T1>::max()
+           && "value was supposed to be within bounds of destination type");
+    return value;
+}
+
 [[nodiscard]] inline short sanitizing_inc(short value)
 {
     int res = value + 1;
-    assert(res >= std::numeric_limits<short>::min() && res <= 
std::numeric_limits<short>::max()
-           && "nValue was supposed to be incrementable without overflow");
-    return static_cast<short>(res);
+    return o3tl::sanitizing_cast<short>(res);
 }
 
 [[nodiscard]] inline short sanitizing_dec(short value)
 {
     int res = value - 1;
-    assert(res >= std::numeric_limits<short>::min() && res <= 
std::numeric_limits<short>::max()
-           && "nValue was supposed to be decrementable without underflow");
-    return static_cast<short>(res);
+    return o3tl::sanitizing_cast<short>(res);
 }
 
 // A hammer that can be used when coverity refuses to accept that code is safe
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx 
b/sd/source/ui/animations/CustomAnimationDialog.cxx
index a02024ceb09e..d6236954a044 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -542,7 +542,7 @@ IMPL_LINK(SdRotationPropertyBox, implMenuSelectHdl, const 
OUString&, rIdent, voi
 {
     auto nValue = mxMetric->get_value(FieldUnit::DEGREE);
     bool bDirection = nValue >= 0;
-    nValue = (nValue < 0 ? -nValue : nValue);
+    if (nValue < 0) nValue = o3tl::saturating_toggle_sign(nValue);
 
     if (rIdent == "clockwise")
         bDirection = true;
diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx
index 2946f934c274..e26d34f47066 100644
--- a/sd/source/ui/dlg/vectdlg.cxx
+++ b/sd/source/ui/dlg/vectdlg.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <officecfg/Office/Common.hxx>
+#include <o3tl/untaint.hxx>
 #include <vcl/vclenum.hxx>
 #include <vcl/BitmapReadAccess.hxx>
 #include <vcl/bitmap/BitmapSimpleColorQuantizationFilter.hxx>
@@ -304,7 +305,7 @@ void SdVectorizeDlg::SaveSettings() const
     std::shared_ptr<comphelper::ConfigurationChanges> batch(
         comphelper::ConfigurationChanges::create());
     
officecfg::Office::Common::Vectorize::ColorCount::set(m_xNmLayers->get_value(),batch);
-    
officecfg::Office::Common::Vectorize::PointReduce::set(m_xMtReduce->get_value(FieldUnit::NONE),batch);
+    
officecfg::Office::Common::Vectorize::PointReduce::set(o3tl::sanitizing_cast<sal_Int16>(m_xMtReduce->get_value(FieldUnit::NONE)),batch);
     
officecfg::Office::Common::Vectorize::FillHole::set(m_xCbFillHoles->get_active(),batch);
     
officecfg::Office::Common::Vectorize::TileExtent::set(m_xMtFillHoles->get_value(FieldUnit::NONE),batch);
     batch->commit();
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx 
b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
index d5a6f9840052..cb88a16e54e5 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "GraphicPropertyPanel.hxx"
+#include <o3tl/untaint.hxx>
 #include <svx/strings.hrc>
 #include <svx/svxids.hrc>
 #include <svx/dialmgr.hxx>
@@ -90,7 +91,7 @@ void GraphicPropertyPanel::Initialize()
 
 IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyBrightnessHdl, 
weld::MetricSpinButton&, void )
 {
-    const sal_Int16 nBright = mxMtrBrightness->get_value(FieldUnit::PERCENT);
+    const sal_Int16 nBright = 
o3tl::sanitizing_cast<sal_Int16>(mxMtrBrightness->get_value(FieldUnit::PERCENT));
     const SfxInt16Item aBrightItem( SID_ATTR_GRAF_LUMINANCE, nBright );
     GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_LUMINANCE,
             SfxCallMode::RECORD, { &aBrightItem });
@@ -99,7 +100,7 @@ IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyBrightnessHdl, 
weld::MetricSpinButt
 
 IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyContrastHdl, 
weld::MetricSpinButton&, void )
 {
-    const sal_Int16 nContrast = mxMtrContrast->get_value(FieldUnit::PERCENT);
+    const sal_Int16 nContrast = 
o3tl::sanitizing_cast<sal_Int16>(mxMtrContrast->get_value(FieldUnit::PERCENT));
     const SfxInt16Item aContrastItem( SID_ATTR_GRAF_CONTRAST, nContrast );
     GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_CONTRAST,
             SfxCallMode::RECORD, { &aContrastItem });
@@ -108,7 +109,7 @@ IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyContrastHdl, 
weld::MetricSpinButton
 
 IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyTransHdl, 
weld::MetricSpinButton&, void )
 {
-    const sal_Int16 nTrans = mxMtrTrans->get_value(FieldUnit::PERCENT);
+    const sal_Int16 nTrans = 
o3tl::sanitizing_cast<sal_Int16>(mxMtrTrans->get_value(FieldUnit::PERCENT));
     const SfxUInt16Item aTransItem( SID_ATTR_GRAF_TRANSPARENCE, nTrans );
     GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_TRANSPARENCE,
             SfxCallMode::RECORD, { &aTransItem });

Reply via email to