[Libreoffice-commits] core.git: svx/source xmloff/source

Caolán McNamara caolanm at redhat.com
Tue Nov 24 07:19:29 PST 2015


 svx/source/items/e3ditem.cxx       |    5 +++++
 xmloff/source/draw/ximp3dscene.cxx |   11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 7acbf173fc9f624da144a242e33033de56550a2f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 24 15:06:32 2015 +0000

    crashtesting: ooo72999-1.ods NaNs found in light direction
    
    and NaN != NaN so busted logic propogates, drop invalid directions
    on initial read
    
    Change-Id: Ic76c714666df14d37a4c68f43b817327675bd0e0

diff --git a/svx/source/items/e3ditem.cxx b/svx/source/items/e3ditem.cxx
index d41b778..f853012 100644
--- a/svx/source/items/e3ditem.cxx
+++ b/svx/source/items/e3ditem.cxx
@@ -95,6 +95,8 @@ SvStream& SvxB3DVectorItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/
 
 bool SvxB3DVectorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
 {
+    assert(!isnan(aVal.getX()) && !isnan(aVal.getY()) && !isnan(aVal.getZ()));
+
     drawing::Direction3D aDirection;
 
     // Werte eintragen
@@ -117,6 +119,9 @@ bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
     aVal.setX(aDirection.DirectionX);
     aVal.setY(aDirection.DirectionY);
     aVal.setZ(aDirection.DirectionZ);
+
+    assert(!isnan(aVal.getX()) && !isnan(aVal.getY()) && !isnan(aVal.getZ()));
+
     return true;
 }
 
diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx
index 5fc4b45..83c2033 100644
--- a/xmloff/source/draw/ximp3dscene.cxx
+++ b/xmloff/source/draw/ximp3dscene.cxx
@@ -64,7 +64,16 @@ SdXML3DLightContext::SdXML3DLightContext(
             }
             case XML_TOK_3DLIGHT_DIRECTION:
             {
-                SvXMLUnitConverter::convertB3DVector(maDirection, sValue);
+                ::basegfx::B3DVector aVal;
+                SvXMLUnitConverter::convertB3DVector(aVal, sValue);
+                if (!isnan(aVal.getX()) && !isnan(aVal.getY()) && !isnan(aVal.getZ()))
+                {
+                    maDirection = aVal;
+                }
+                else
+                {
+                    SAL_WARN("xmloff", "NaNs found in light direction: " << sValue);
+                }
                 break;
             }
             case XML_TOK_3DLIGHT_ENABLED:


More information about the Libreoffice-commits mailing list