svx/source/svdraw/svdedtv1.cxx |   23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

New commits:
commit 5de080cae9bf09a2e360974e7b31567272c89798
Author:     Armin Le Grand (Collabora) <armin.le.gr...@me.com>
AuthorDate: Fri Dec 20 16:12:50 2024 +0100
Commit:     Armin Le Grand <armin.le.gr...@me.com>
CommitDate: Fri Dec 20 20:00:17 2024 +0100

    tdf#164285 secure access to SID_ATTR_TRANSFORM_SIZE_POINT
    
    Change-Id: Ice52f9be8ecc1887de48f3538b5627514518aef1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178936
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>
    Tested-by: Jenkins

diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 6a098d3568a0..acf0b6885028 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -1580,8 +1580,6 @@ static Point ImpGetPoint(const tools::Rectangle& rRect, 
RectPoint eRP)
 
 void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool 
addPageMargin)
 {
-    const bool bTiledRendering = comphelper::LibreOfficeKit::isActive();
-
     tools::Rectangle aRect(GetMarkedObjRect());
 
     if(GetSdrPageView())
@@ -1664,11 +1662,24 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& 
rAttr, bool addPageMargin
         bChgSiz=true;
         bChgHgt=true;
     }
-    if (bChgSiz) {
-        if (bTiledRendering && SfxItemState::SET != 
rAttr.GetItemState(SID_ATTR_TRANSFORM_SIZE_POINT))
+
+    if (bChgSiz)
+    {
+        // tdf#164285 the item was accessed even when not being set if
+        // false == comphelper::LibreOfficeKit::isActive(). For SlotIDs
+        // like SID_ATTR_TRANSFORM_SIZE_POINT this will crash by asserting
+        // due to SlotIDs having no defaults (see
+        // SfxItemPool::GetUserOrPoolDefaultItem line 725)
+        if (const SfxUInt16Item* pPoolItem = 
rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_SIZE_POINT))
+            eSizePoint = static_cast<RectPoint>(pPoolItem->GetValue());
+        else if (comphelper::LibreOfficeKit::isActive())
+            // for TiledRendering the default which is set at the start of
+            // this method to RectPoint::MM seems purposely being changed to
+            // RectPoint::LT here - from a change 6 years ago. Note that this
+            // will make chosing another definition point in the UI for the
+            // PosSizeDialog except TopLeft not working when
+            // comphelper::LibreOfficeKit *is* active.
             eSizePoint = RectPoint::LT;
-        else
-            eSizePoint = 
static_cast<RectPoint>(rAttr.Get(SID_ATTR_TRANSFORM_SIZE_POINT).GetValue());
     }
 
     // rotation

Reply via email to