[Libreoffice-commits] core.git: oox/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 26 20:14:41 UTC 2021


 oox/source/drawingml/fillproperties.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit bbce1482f161e6e7562fad39897a04454e1c726b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 26 14:59:30 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 26 21:13:58 2021 +0100

    cid#1472266 silence Using invalid iterator
    
    Change-Id: I5d332a7f0c718614ad8e07408161e214c4d9d876
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109966
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 597e89da8eb8..c8946c15f9a8 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -412,6 +412,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                     {
                         GradientFillProperties::GradientStopMap::const_iterator aItA( aGradientStops.begin() );
                         GradientFillProperties::GradientStopMap::const_iterator aItZ(std::prev(aGradientStops.end()));
+                        assert(aItZ != aGradientStops.end());
                         while( bSymmetric && aItA->first < aItZ->first )
                         {
                             if (!aItA->second.equals(aItZ->second, rGraphicHelper, nPhClr))
@@ -498,8 +499,11 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                     {
                         // Two segments, second is uniformly coloured
                         SAL_INFO("oox.drawingml.gradient", "two segments, second is uniformly coloured");
-                        nBorder = std::prev(aGradientStops.end())->first - std::next(aGradientStops.begin())->first;
-                        aGradientStops.erase(std::next(aGradientStops.begin()));
+                        auto aNext = std::next(aGradientStops.begin());
+                        auto aPrev = std::prev(aGradientStops.end());
+                        assert(aPrev != aGradientStops.end());
+                        nBorder = aPrev->first - aNext->first;
+                        aGradientStops.erase(aNext);
                         aWidestSegmentStart = aGradientStops.begin();
                         bSwap = true;
                         nShapeRotation = 180*60000 - nShapeRotation;


More information about the Libreoffice-commits mailing list