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

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Apr 8 03:41:24 UTC 2016


 oox/source/export/ColorPropertySet.cxx |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 753c474b199a9c12f182c89c487133f9fa88e352
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Apr 8 05:06:54 2016 +0200

    fix many ooxml validation errors
    
    This code was just horribly broken. Every requested property would
    return the color value which if interepreted as an alpha value gave
    invalid values.
    
    This now contains an assert that might trigger in the next set of crash
    testing.
    
    Change-Id: I959084dbce2d28878b50ec52ece71397d4ace561
    Reviewed-on: https://gerrit.libreoffice.org/23909
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/oox/source/export/ColorPropertySet.cxx b/oox/source/export/ColorPropertySet.cxx
index 3fb4b9a..bab61b0 100644
--- a/oox/source/export/ColorPropertySet.cxx
+++ b/oox/source/export/ColorPropertySet.cxx
@@ -108,13 +108,20 @@ Reference< XPropertySetInfo > SAL_CALL ColorPropertySet::getPropertySetInfo()
     return m_xInfo;
 }
 
-void SAL_CALL ColorPropertySet::setPropertyValue( const OUString& /* aPropertyName */, const uno::Any& aValue )
+void SAL_CALL ColorPropertySet::setPropertyValue( const OUString& rPropertyName, const uno::Any& aValue )
     throw (UnknownPropertyException,
            PropertyVetoException,
            lang::IllegalArgumentException,
            lang::WrappedTargetException,
            uno::RuntimeException, std::exception)
 {
+    if (rPropertyName != m_aColorPropName)
+    {
+        // trying to catch these cases in the next crash testing
+        assert(false);
+        return;
+    }
+
     aValue >>= m_nColor;
 }
 
@@ -128,7 +135,10 @@ uno::Any SAL_CALL ColorPropertySet::getPropertyValue( const OUString& aPropertyN
         css::drawing::FillStyle aFillStyle = css::drawing::FillStyle_SOLID;
         return uno::makeAny(aFillStyle);
     }
-    return uno::makeAny( m_nColor );
+    else if (aPropertyName == m_aColorPropName)
+        return uno::makeAny( m_nColor );
+
+    throw UnknownPropertyException();
 }
 
 void SAL_CALL ColorPropertySet::addPropertyChangeListener( const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* xListener */ )
@@ -199,6 +209,7 @@ uno::Any SAL_CALL ColorPropertySet::getPropertyDefault( const OUString& aPropert
 {
     if( aPropertyName.equals( m_aColorPropName ))
         return uno::makeAny( m_nDefaultColor );
+
     return uno::Any();
 }
 


More information about the Libreoffice-commits mailing list