diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-14 14:24:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-14 18:02:03 +0100 |
commit | 78693c376ed1bdf6d859a44c2651030dc9c970f8 (patch) | |
tree | 28e1c7ba2a1c7acdb131599691c8774ec0f6a30c /basic/source/classes | |
parent | 78a18a5dc6986c9f5612f26d164c62202a1b94f8 (diff) |
tdf#108189 inspection of object hangs LO
There is no general solution to this that I am aware of, so just
implement a rather specific solution that will need periodic extending
to check for other dangerous properties
Change-Id: Ie09d89416fea5b7cdf782319ed9921657faa5a5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176593
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/classes')
-rw-r--r-- | basic/source/classes/sbunoobj.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 7f75e18bbe5b..25a395e7a6bf 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/script/ArrayWrapper.hpp> #include <com/sun/star/script/CannotConvertException.hpp> #include <com/sun/star/script/NativeObjectWrapper.hpp> +#include <com/sun/star/sheet/XSheetCellCursor.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/DeploymentException.hpp> @@ -2585,6 +2586,27 @@ SbUnoProperty::SbUnoProperty SbUnoProperty::~SbUnoProperty() {} +bool isVeryLargeUnoProperty(SbxVariable const * pVar) +{ + auto pUnoVar = dynamic_cast<const SbUnoProperty*>(pVar); + if (!pUnoVar) + return false; + // The ScCellRangeObj methods will attempt to generate massive strings, + // which will use up massive amounts of RAM and also lock of the program + // for some time. + const OUString & aUnoName = pUnoVar->getUnoName(); + if (aUnoName == "DataArray" || aUnoName == "FormulaArray") + { + auto pParent = dynamic_cast<const SbUnoObject*>(pUnoVar->GetParent()); + if (!pParent) + return false; + css::uno::Any aAny = const_cast<SbUnoObject*>(pParent)->getUnoAny(); + css::uno::Reference<css::sheet::XSheetCellCursor> xCursor = aAny.query<css::sheet::XSheetCellCursor>(); + if (xCursor) + return true; + } + return false; +} SbxVariable* SbUnoObject::Find( const OUString& rName, SbxClassType t ) { |