diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-05-31 23:45:53 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-06-01 00:11:10 +0200 |
commit | c11e60f11f34b12bf73a08a96634202a8d3aef0c (patch) | |
tree | da82b8736f93578800a4a77acc0c13aaed0e2a84 /extensions/source | |
parent | 299946676fdced263305db35164950ada1caba0b (diff) |
tdf#99643 OLE automation bridge: fix 64-bit pointer conversions
XBridgeSupplier2::createBridge() is always called in-process and should
therefore expect and create Anys with native-sized encoded pointers,
so use sal_uIntPtr.
Change-Id: Ia757ff38568b07de8085a1a9d323d806bcca0f63
Note: Currently all calls in LO code are with source=UNO, target=OLE.
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/ole/oleobjw.cxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/servprov.cxx | 10 | ||||
-rw-r--r-- | extensions/source/ole/unoconversionutilities.hxx | 6 |
3 files changed, 10 insertions, 8 deletions
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index b2fde4a3a406..2a2b7eb256f1 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -725,7 +725,7 @@ Any SAL_CALL IUnknownWrapper_Impl::createBridge( const Any& modelDepObject, pVariant->punkVal->AddRef(); } - ret.setValue((void*)&pVariant, cppu::UnoType<sal_uInt32>::get()); + ret.setValue(static_cast<void*>(&pVariant), cppu::UnoType<sal_uIntPtr>::get()); } } diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx index 6d3d5fa38f30..95b3badf5ae2 100644 --- a/extensions/source/ole/servprov.cxx +++ b/extensions/source/ole/servprov.cxx @@ -160,7 +160,7 @@ STDMETHODIMP ProviderOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter, OLE); - if (oleAny.getValueTypeClass() == cppu::UnoType<sal_uInt32>::get().getTypeClass()) + if (oleAny.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass()) { VARIANT* pVariant = *(VARIANT**)oleAny.getValue(); @@ -291,7 +291,7 @@ STDMETHODIMP OneInstanceOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter, OLE); - if (oleAny.getValueTypeClass() == TypeClass_UNSIGNED_LONG) + if (oleAny.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass()) { VARIANT* pVariant = *(VARIANT**)oleAny.getValue(); @@ -374,14 +374,14 @@ Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject, CoTaskMemFree(pVariant); throw IllegalArgumentException(); } - ret.setValue((void*) &pVariant, cppu::UnoType<sal_uInt32>::get()); + ret.setValue(static_cast<void*>(&pVariant), cppu::UnoType<sal_uIntPtr>::get()); } else throw IllegalArgumentException(); } else if (sourceModelType == OLE) { - if (modelDepObject.getValueType() != cppu::UnoType<sal_uInt32>::get()) + if (modelDepObject.getValueType() != cppu::UnoType<sal_uIntPtr>::get()) { throw IllegalArgumentException(); } @@ -397,7 +397,7 @@ Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject, } else { - ret.setValue((void*) &pVariant, cppu::UnoType<sal_uInt32>::get()); + ret.setValue(static_cast<void*>(&pVariant), cppu::UnoType<sal_uIntPtr>::get()); } } else if (destModelType == UNO) diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index bdf61db5456e..e1459b855172 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -244,8 +244,10 @@ bool convertSelfToCom( T& unoInterface, VARIANT * pVar) Sequence<sal_Int8> seqId( arId, 16); Any anySource; anySource <<= xInt; - Any anyDisp= xSupplier->createBridge( anySource, seqId, UNO, OLE); - if( anyDisp.getValueTypeClass() == TypeClass_UNSIGNED_LONG) + Any anyDisp = xSupplier->createBridge(anySource, seqId, UNO, OLE); + + // due to global-process-id check this must be in-process pointer + if (anyDisp.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass()) { VARIANT* pvariant= *(VARIANT**)anyDisp.getValue(); HRESULT hr; |