[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - filter/source

Michael Stahl mstahl at redhat.com
Fri Feb 15 02:39:00 PST 2013


 filter/source/svg/svgreader.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 6c7378cbde5de3895d648b8aa89a6947b8831880
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Feb 13 15:42:37 2013 +0100

    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)
    Reviewed-on: https://gerrit.libreoffice.org/2139
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

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 @@ struct AnnotatingVisitor
     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 @@ struct AnnotatingVisitor
         }
 
         rGradient.maStops = aNewStops;
+        if (rGradient.maStops.size() < 2)
+        {
+            return; // can't optimize further...
+        }
 
         // axial gradient, maybe?
         if( rGradient.meType == Gradient::LINEAR &&


More information about the Libreoffice-commits mailing list