sc/source/core/tool/interpr4.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 01f4c0a25e4749875e27c63bfb824df6c4687535
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Jul 27 14:31:32 2023 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri Jul 28 13:19:31 2023 +0200

    crashtesting: std::bad_alloc on load of forum-mso-en4-123509.xlsx
    
    this appeared in crashtesting with:
    
    commit d15c4caabaa21e0efe3a08ffbe145390e802bab9
    Date:   Tue Sep 20 08:14:41 2022 -0400
    
        tdf#123026 xlsx import: recalc optimal row height on import
    
    rut existed as a caught exception during load before that.
    
    Change-Id: I90405a7acb84c95bac350808b20482e5069e2fcf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154990
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 97c3d06cdf49..95596b0ed14d 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1607,7 +1607,16 @@ bool ScInterpreter::ConvertMatrixParameters()
             xNew = (*aMapIter).second;
         else
         {
-            auto pJumpMat = std::make_shared<ScJumpMatrix>( pCur->GetOpCode(), 
nJumpCols, nJumpRows);
+            std::shared_ptr<ScJumpMatrix> pJumpMat;
+            try
+            {
+                pJumpMat = std::make_shared<ScJumpMatrix>( pCur->GetOpCode(), 
nJumpCols, nJumpRows);
+            }
+            catch (const std::bad_alloc&)
+            {
+                SAL_WARN("sc.core", "std::bad_alloc in ScJumpMatrix ctor with 
" << nJumpCols << " columns and " << nJumpRows << " rows");
+                return false;
+            }
             pJumpMat->SetAllJumps( 1.0, nStart, nNext, nStop);
             // pop parameters and store in ScJumpMatrix, push in JumpMatrix()
             ScTokenVec aParams(nParams);

Reply via email to