[Libreoffice-commits] core.git: 2 commits - connectivity/source sax/source

Lionel Elie Mamane lionel at mamane.lu
Mon Mar 2 09:24:17 PST 2015


 connectivity/source/commontools/FValue.cxx |   32 ++++++++++++++---------------
 sax/source/expatwrap/sax_expat.cxx         |    5 ++++
 2 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit 61439adce623ce2e66d9f009f877e165b62f2051
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Mon Mar 2 18:19:18 2015 +0100

    getAny() is not a safe default, it assumes there is actually an Any
    
    at *m_aValue.m_pValue.
    But there could not even be a pointer there, e.g. if m_aValue.m_nIntXX is in use.
    Then the pointer dereference usually leads to a crash.
    Can e.g. be reproduced by calling getBytes() on an integer column of a RowSet.
    
    Change-Id: Ib5361d838d2869142fd797d4e3454e2562ea7acf

diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index b16078d..f6ce644 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -964,7 +964,7 @@ Any ORowSetValue::makeAny() const
                 break;
             default:
                 SAL_WARN( "connectivity.commontools","ORowSetValue::makeAny(): UNSPUPPORTED TYPE!");
-                rValue = getAny();
+                rValue = makeAny();
                 break;
         }
     }
@@ -1049,7 +1049,7 @@ OUString ORowSetValue::getString( ) const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= aRet;
                     break;
                 }
@@ -1120,7 +1120,7 @@ bool ORowSetValue::getBool()    const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= bRet;
                     break;
                 }
@@ -1191,7 +1191,7 @@ sal_Int8 ORowSetValue::getInt8()    const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= nRet;
                     break;
                 }
@@ -1262,7 +1262,7 @@ sal_uInt8 ORowSetValue::getUInt8()    const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= nRet;
                     break;
                 }
@@ -1334,7 +1334,7 @@ sal_Int16 ORowSetValue::getInt16()  const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= nRet;
                     break;
                 }
@@ -1405,7 +1405,7 @@ sal_uInt16 ORowSetValue::getUInt16()  const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= nRet;
                     break;
                 }
@@ -1478,7 +1478,7 @@ sal_Int32 ORowSetValue::getInt32()  const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= nRet;
                     break;
                 }
@@ -1551,7 +1551,7 @@ sal_uInt32 ORowSetValue::getUInt32()  const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= nRet;
                     break;
                 }
@@ -1624,7 +1624,7 @@ sal_Int64 ORowSetValue::getLong()   const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= nRet;
                     break;
                 }
@@ -1697,7 +1697,7 @@ sal_uInt64 ORowSetValue::getULong()   const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= nRet;
                     break;
                 }
@@ -1774,7 +1774,7 @@ float ORowSetValue::getFloat()  const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= nRet;
                     break;
                 }
@@ -1850,7 +1850,7 @@ double ORowSetValue::getDouble()    const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= nRet;
                     break;
                 }
@@ -1921,7 +1921,7 @@ Sequence<sal_Int8>  ORowSetValue::getSequence() const
                 break;
             default:
                 {
-                    Any aValue = getAny();
+                    Any aValue = makeAny();
                     aValue >>= aSeq;
                     break;
                 }
@@ -2024,7 +2024,7 @@ Sequence<sal_Int8>  ORowSetValue::getSequence() const
                 break;
             default:
                 {
-                    Any aAnyValue = getAny();
+                    Any aAnyValue = makeAny();
                     aAnyValue >>= aValue;
                     break;
                 }
@@ -2076,7 +2076,7 @@ Sequence<sal_Int8>  ORowSetValue::getSequence() const
                 break;
             default:
                 {
-                    Any aAnyValue = getAny();
+                    Any aAnyValue = makeAny();
                     aAnyValue >>= aValue;
                     break;
                 }
commit 5df77f0d3bcc7015139fed8b5a38a93d9242de69
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Feb 5 21:35:51 2015 +0100

    make parsing more cautious with exceptions
    
    also handle UNO exceptions that are not RuntimeException
    
    Change-Id: I7050de6ee4b2e4f2af2e0a0be42ba65e0bc028db

diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index 2aa3041..5b02ca9 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -124,6 +124,11 @@ OUString XmlChar2OUString( const XML_Char *p )
             pThis->bRTExceptionWasThrown = true; \
             pImpl->rtexception = e; \
         }\
+        catch( const com::sun::star::uno::Exception &e ) {\
+            pThis->bExceptionWasThrown = true; \
+            pThis->bRTExceptionWasThrown = true; \
+            pImpl->rtexception = WrappedTargetRuntimeException("Non-runtime UNO exception caught during parse", e.Context, makeAny(e)); \
+        }\
     }\
     ((void)0)
 


More information about the Libreoffice-commits mailing list