To fix fdo#47068 in master I pushed
47bc24a6bf5074c59d2f2a6bef79e5e70c842889 which should be completely
logically equivalent seeing as the problematic ImplIntrospectionAccess
is only used to get access to its mpStaticImpl which is also passed to
the calling object anyway
attached is my proposed backport to 3-5
C.
From 4e1a61da85c5a3a5eab490ec4c16ff3ead259ae3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 5 Apr 2012 14:08:39 +0100
Subject: [PATCH] Resolves: fdo#47068 use of pointer to deleted object
---
stoc/source/inspect/introspection.cxx | 83 ++++++++++++++++++--------------
1 files changed, 47 insertions(+), 36 deletions(-)
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 3b0ecf6..e8a2084 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -735,9 +735,6 @@ class ImplIntrospectionAdapter :
public XEnumerationAccess, public XIdlArray,
public OWeakObject
{
- // Parent-Objekt
- ImplIntrospectionAccess* mpAccess;
-
// Untersuchtes Objekt
const Any& mrInspectedObject;
@@ -757,8 +754,7 @@ class ImplIntrospectionAdapter :
Reference<XIdlArray> mxObjIdlArray;
public:
- ImplIntrospectionAdapter( ImplIntrospectionAccess* pAccess_,
- const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ );
+ ImplIntrospectionAdapter( const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ );
~ImplIntrospectionAdapter();
// Methoden von XInterface
@@ -836,9 +832,9 @@ public:
throw( IllegalArgumentException, ArrayIndexOutOfBoundsException, RuntimeException );
};
-ImplIntrospectionAdapter::ImplIntrospectionAdapter( ImplIntrospectionAccess* pAccess_,
- const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ )
- : mpAccess( pAccess_), mrInspectedObject( obj ), mpStaticImpl( pStaticImpl_ )
+ImplIntrospectionAdapter::ImplIntrospectionAdapter( const Any& obj,
+ IntrospectionAccessStatic_Impl* pStaticImpl_ )
+ : mrInspectedObject( obj ), mpStaticImpl( pStaticImpl_ )
{
mpStaticImpl->acquire();
@@ -1077,16 +1073,54 @@ Sequence< Property > ImplIntrospectionAdapter::getProperties(void) throw(
Runtim
return mpStaticImpl->getProperties();
}
+namespace
+{
+ Property getPropertyImpl(IntrospectionAccessStatic_Impl *pStaticImpl, const OUString& Name,
sal_Int32 PropertyConcepts)
+ throw( NoSuchElementException, RuntimeException )
+ {
+ Property aRet;
+ sal_Int32 i = pStaticImpl->getPropertyIndex( Name );
+ sal_Bool bFound = sal_False;
+ if( i != -1 )
+ {
+ sal_Int32 nConcept = pStaticImpl->getPropertyConcepts().getConstArray()[ i ];
+ if( (PropertyConcepts & nConcept) != 0 )
+ {
+ const Property* pProps = pStaticImpl->getProperties().getConstArray();
+ aRet = pProps[ i ];
+ bFound = sal_True;
+ }
+ }
+ if( !bFound )
+ throw NoSuchElementException() ;
+ return aRet;
+ }
+
+ sal_Bool hasPropertyImpl(IntrospectionAccessStatic_Impl *pStaticImpl, const OUString& Name,
sal_Int32 PropertyConcepts)
+ throw( RuntimeException )
+ {
+ sal_Int32 i = pStaticImpl->getPropertyIndex( Name );
+ sal_Bool bRet = sal_False;
+ if( i != -1 )
+ {
+ sal_Int32 nConcept = pStaticImpl->getPropertyConcepts().getConstArray()[ i ];
+ if( (PropertyConcepts & nConcept) != 0 )
+ bRet = sal_True;
+ }
+ return bRet;
+ }
+}
+
Property ImplIntrospectionAdapter::getPropertyByName(const OUString& Name)
throw( RuntimeException )
{
- return mpAccess->getProperty( Name, PropertyConcept::ALL );
+ return getPropertyImpl(mpStaticImpl, Name, PropertyConcept::ALL);
}
sal_Bool ImplIntrospectionAdapter::hasPropertyByName(const OUString& Name)
throw( RuntimeException )
{
- return mpAccess->hasProperty( Name, PropertyConcept::ALL );
+ return hasPropertyImpl(mpStaticImpl, Name, PropertyConcept::ALL);
}
// Methoden von XElementAccess
@@ -1231,36 +1265,13 @@ sal_Int32 ImplIntrospectionAccess::getSuppliedPropertyConcepts(void)
Property ImplIntrospectionAccess::getProperty(const OUString& Name, sal_Int32 PropertyConcepts)
throw( NoSuchElementException, RuntimeException )
{
- Property aRet;
- sal_Int32 i = mpStaticImpl->getPropertyIndex( Name );
- sal_Bool bFound = sal_False;
- if( i != -1 )
- {
- sal_Int32 nConcept = mpStaticImpl->getPropertyConcepts().getConstArray()[ i ];
- if( (PropertyConcepts & nConcept) != 0 )
- {
- const Property* pProps = mpStaticImpl->getProperties().getConstArray();
- aRet = pProps[ i ];
- bFound = sal_True;
- }
- }
- if( !bFound )
- throw NoSuchElementException() ;
- return aRet;
+ return getPropertyImpl(mpStaticImpl, Name, PropertyConcepts);
}
sal_Bool ImplIntrospectionAccess::hasProperty(const OUString& Name, sal_Int32 PropertyConcepts)
throw( RuntimeException )
{
- sal_Int32 i = mpStaticImpl->getPropertyIndex( Name );
- sal_Bool bRet = sal_False;
- if( i != -1 )
- {
- sal_Int32 nConcept = mpStaticImpl->getPropertyConcepts().getConstArray()[ i ];
- if( (PropertyConcepts & nConcept) != 0 )
- bRet = sal_True;
- }
- return bRet;
+ return hasPropertyImpl(mpStaticImpl, Name, PropertyConcepts);
}
Sequence< Property > ImplIntrospectionAccess::getProperties(sal_Int32 PropertyConcepts)
@@ -1447,7 +1458,7 @@ Reference<XInterface> SAL_CALL ImplIntrospectionAccess::queryAdapter( const
Type
if( !mpAdapter )
{
((ImplIntrospectionAccess*)this)->mpAdapter =
- new ImplIntrospectionAdapter( this, maInspectedObject, mpStaticImpl );
+ new ImplIntrospectionAdapter( maInspectedObject, mpStaticImpl );
// Selbst eine Referenz halten
mpAdapter->acquire();
--
1.7.7.6
Context
- [REVIEW 3-5] fix in stoc's introspection to solve fdo#47068 · Caolán McNamara
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.