diff options
-rw-r--r-- | comphelper/source/property/propagg.cxx | 6 | ||||
-rw-r--r-- | cppuhelper/source/propshlp.cxx | 4 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 4 | ||||
-rw-r--r-- | forms/source/component/ListBox.cxx | 4 | ||||
-rw-r--r-- | svx/source/table/cell.cxx | 3 | ||||
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/unocore/unoparagraph.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unoport.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrolmodel.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/forms/gridcolumnproptranslator.cxx | 3 |
10 files changed, 39 insertions, 1 deletions
diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx index 0d8ea6a10bb9..5a0574460cf4 100644 --- a/comphelper/source/property/propagg.cxx +++ b/comphelper/source/property/propagg.cxx @@ -589,6 +589,9 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues( OPropertySetHelper::setPropertyValues(_rPropertyNames, _rValues); else if (_rPropertyNames.getLength() == 1) // use the more efficient way { + if (_rValues.getLength() != 1) + throw IllegalArgumentException("lengths do not match", static_cast<XPropertySet*>(this), + -1); try { setPropertyValue( _rPropertyNames[0], _rValues[0] ); @@ -631,6 +634,9 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues( // mixed else { + if (_rValues.getLength() != nLen) + throw IllegalArgumentException("lengths do not match", + static_cast<XPropertySet*>(this), -1); const css::uno::Any* pValues = _rValues.getConstArray(); // dividing the Names and _rValues diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index 3af4cda49bb7..18ee9d1bb770 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -25,6 +25,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <memory> #include <sal/log.hxx> @@ -867,6 +868,9 @@ void OPropertySetHelper::setPropertyValues( const Sequence<Any>& rValues ) { sal_Int32 nSeqLen = rPropertyNames.getLength(); + if (nSeqLen != rValues.getLength()) + throw IllegalArgumentException("lengths do not match", static_cast<XPropertySet*>(this), + -1); std::unique_ptr<sal_Int32[]> pHandles(new sal_Int32[ nSeqLen ]); // get the map table IPropertyArrayHelper & rPH = getInfoHelper(); diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 4f831a70a30f..8d6b2aa9ec53 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -746,6 +746,10 @@ void SAL_CALL SvxUnoTextRangeBase::setPropertyValues( const uno::Sequence< OUStr void SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues, sal_Int32 nPara ) { + if (aPropertyNames.getLength() != aValues.getLength()) + throw lang::IllegalArgumentException("lengths do not match", + static_cast<css::beans::XPropertySet*>(this), -1); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr; diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 700bf6989304..79d6be399d6b 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -473,6 +473,10 @@ namespace frm ); if ( ( pSelectedItemsPos != _rPropertyNames.end() ) && aStringItemListExists ) { + if (_rPropertyNames.getLength() != _rValues.getLength()) + throw css::lang::IllegalArgumentException("lengths do not match", + static_cast<cppu::OWeakObject*>(this), -1); + // both properties are present // -> remember the value for the select sequence pSelectSequenceValue = _rValues.getConstArray() + ( pSelectedItemsPos - _rPropertyNames.begin() ); diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index a358865334d9..5dbc1ee1a8e5 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -1282,6 +1282,9 @@ void SAL_CALL Cell::setPropertyValues( const Sequence< OUString >& aPropertyName throw DisposedException(); const sal_Int32 nCount = aPropertyNames.getLength(); + if (nCount != aValues.getLength()) + throw css::lang::IllegalArgumentException("lengths do not match", + static_cast<cppu::OWeakObject*>(this), -1); const OUString* pNames = aPropertyNames.getConstArray(); const Any* pValues = aValues.getConstArray(); diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 0a26c6983ae7..60dd13aeac7d 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1679,8 +1679,11 @@ void SAL_CALL SvxShape::setPropertyValues( const css::uno::Sequence< OUString >& ::SolarMutexGuard aSolarGuard; const sal_Int32 nCount = aPropertyNames.getLength(); - const OUString* pNames = aPropertyNames.getConstArray(); + if (nCount != aValues.getLength()) + throw css::lang::IllegalArgumentException("lengths do not match", + static_cast<cppu::OWeakObject*>(this), -1); + const OUString* pNames = aPropertyNames.getConstArray(); const uno::Any* pValues = aValues.getConstArray(); // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index e741cfa7a095..308ed9fa8dea 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -421,6 +421,10 @@ void SAL_CALL SwXParagraph::setPropertyValues( const uno::Sequence< OUString >& rPropertyNames, const uno::Sequence< uno::Any >& rValues ) { + if (rPropertyNames.getLength() != rValues.getLength()) + throw lang::IllegalArgumentException("lengths do not match", + static_cast<cppu::OWeakObject*>(this), -1); + SolarMutexGuard aGuard; // workaround for bad designed API diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index d34dc615f56e..d0bc33645e4d 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -424,6 +424,10 @@ void SwXTextPortion::SetPropertyValues_Impl( const uno::Sequence< OUString >& rPropertyNames, const uno::Sequence< uno::Any >& rValues ) { + if (rPropertyNames.getLength() != rValues.getLength()) + throw lang::IllegalArgumentException("lengths do not match", + static_cast<cppu::OWeakObject*>(this), -1); + SwUnoCursor& rUnoCursor = GetCursor(); { diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index c5e8165f60b8..983ea89459ee 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -1290,6 +1290,9 @@ void UnoControlModel::setPropertyValues( const css::uno::Sequence< OUString >& r ::osl::ClearableMutexGuard aGuard( GetMutex() ); sal_Int32 nProps = rPropertyNames.getLength(); + if (nProps != Values.getLength()) + throw css::lang::IllegalArgumentException("lengths do not match", + static_cast<cppu::OWeakObject*>(this), -1); // sal_Int32* pHandles = new sal_Int32[nProps]; // don't do this - it leaks in case of an exception diff --git a/xmloff/source/forms/gridcolumnproptranslator.cxx b/xmloff/source/forms/gridcolumnproptranslator.cxx index aeb1de438815..b10357b84c26 100644 --- a/xmloff/source/forms/gridcolumnproptranslator.cxx +++ b/xmloff/source/forms/gridcolumnproptranslator.cxx @@ -254,6 +254,9 @@ namespace xmloff sal_Int32 nParaAlignPos = findStringElement( aTranslatedNames, getParaAlignProperty() ); if ( nParaAlignPos != -1 ) { + if (aTranslatedNames.getLength() != aTranslatedValues.getLength()) + throw css::lang::IllegalArgumentException( + "lengths do not match", static_cast<cppu::OWeakObject*>(this), -1); aTranslatedNames.getArray()[ nParaAlignPos ] = getAlignProperty(); valueParaAdjustToAlign( aTranslatedValues.getArray()[ nParaAlignPos ] ); } |