sc/source/core/data/column2.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 2439016c562044c59b80fb564eb39fe2509a49b3
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Feb 7 10:20:40 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Feb 7 18:35:46 2024 +0100

    cid#1559963 silence Use after free
    
    by putting aOptions and aOldPattern at same scope
    
    Change-Id: I9c6fecf991b30a0756a3c9d49c13c2ebe64309e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163088
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 2ab310d25722..4d7ef70448ae 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1061,6 +1061,7 @@ void ScColumn::GetOptimalHeight(
             if (!bStdOnly)                      // search covered cells
             {
                 ScNeededSizeOptions aOptions;
+                CellAttributeHolder aOldPattern;
 
                 for (const auto& rSpan : aSpans)
                 {
@@ -1071,7 +1072,7 @@ void ScColumn::GetOptimalHeight(
                         if (rCxt.isForceAutoSize() || 
!(rDocument.GetRowFlags(nRow, nTab) & CRFlags::ManualSize) )
                         {
                             aOptions.aPattern.setScPatternAttr(pPattern);
-                            const CellAttributeHolder aOldPattern(pPattern);
+                            aOldPattern.setScPatternAttr(pPattern);
                             sal_uInt16 nHeight = static_cast<sal_uInt16>(
                                 std::min(
                                     GetNeededSize( nRow, 
rCxt.getOutputDevice(), rCxt.getPPTX(), rCxt.getPPTY(),

Reply via email to