sc/source/filter/oox/worksheethelper.cxx |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit c9f84e636107b1fa29493b3841799d8d8f49fda1
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Dec 12 09:48:39 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Dec 12 11:37:26 2022 +0000

    crashtesting: assert see on loading forum-mso-en4-489894.xlsx
    
    Change-Id: I402705ea911ca248afb812b63a897c1df9884a22
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143980
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/filter/oox/worksheethelper.cxx 
b/sc/source/filter/oox/worksheethelper.cxx
index 010a4189cf7f..2c409e0d7b14 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1378,7 +1378,18 @@ void WorksheetGlobals::finalizeDrawings()
         Needed if the imported document is inserted as "OLE object from file"
         and thus does not provide an OLE size property by itself. */
     if( (maShapeBoundingBox.Width > 0) || (maShapeBoundingBox.Height > 0) )
-        extendUsedArea( getCellRangeFromRectangle( maShapeBoundingBox ) );
+    {
+        ScRange aRange(getCellRangeFromRectangle(maShapeBoundingBox));
+        if (aRange.aStart.Col() < 0)
+            aRange.aStart.SetCol(0);
+        if (aRange.aStart.Row() < 0)
+            aRange.aStart.SetRow(0);
+        if (aRange.aEnd.Col() < 0)
+            aRange.aEnd.SetCol(0);
+        if (aRange.aEnd.Row() < 0)
+            aRange.aEnd.SetRow(0);
+        extendUsedArea(aRange);
+    }
 
     // if no used area is set, default to A1
     if( maUsedArea.aStart.Col() > maUsedArea.aEnd.Col() )

Reply via email to