[PATCH libreoffice-4-0] filter: svg: optimizeGradientStops: fix STL assertion

Michael Stahl (via Code Review) gerrit at gerrit.libreoffice.org
Wed Feb 13 07:39:57 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2139

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/39/2139/1

filter: svg: optimizeGradientStops: fix STL assertion

Check that there is actually more than one element in maStops before
tweaking its first 2 elements (can be reproduced with fdo#60471 Tux.svg)

Change-Id: I7e6ffdf510bb590a9ea9e3782b30247b8fb46ed5
(cherry picked from commit 2f4bd9d44f8bc9e50cd4b1205fa53e0a15ce0954)
---
M filter/source/svg/svgreader.cxx
1 file changed, 5 insertions(+), 1 deletion(-)



diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index c76f117..4d064c7 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -377,7 +377,7 @@
     bool hasGradientOpacity( const Gradient& rGradient )
     {
         return
-            !rGradient.maStops.empty() &&
+            (rGradient.maStops.size() > 1) &&
             (maGradientStopVector[
                  rGradient.maStops[0]].maStopColor.a != 1.0 ||
              maGradientStopVector[
@@ -417,6 +417,10 @@
         }
 
         rGradient.maStops = aNewStops;
+        if (rGradient.maStops.size() < 2)
+        {
+            return; // can't optimize further...
+        }
 
         // axial gradient, maybe?
         if( rGradient.meType == Gradient::LINEAR &&

-- 
To view, visit https://gerrit.libreoffice.org/2139
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e6ffdf510bb590a9ea9e3782b30247b8fb46ed5
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Michael Stahl <mstahl at redhat.com>


More information about the LibreOffice mailing list