diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-03-29 20:11:30 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-03-30 00:02:10 +0200 |
commit | cf560fd387ee9f54d3edaf066c70b411d1f7b299 (patch) | |
tree | 99b1a9980eb172931645b83654ca2c88e9b5b8d3 | |
parent | bd94e9dfd0a4c67266e21baa9ec10a56850d093f (diff) |
use ScTable::ColumnData() in ScDocument::ExtendOverlapped()
Otherwise there's invalid array access triggered by
VBAMacroTest::testVba() with INITIALCOLCOUNT set to 1.
Change-Id: Iaff333788d2d29444139c99b0f6e82b69a5a2d84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132282
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r-- | sc/source/core/data/document.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 363bd168fcab..59d05432ae5c 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5550,25 +5550,25 @@ void ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow, //TODO: pass on ? - ScAttrArray* pAttrArray = maTabs[nTab]->aCol[nOldCol].pAttrArray.get(); + const ScAttrArray& pAttrArray = maTabs[nTab]->ColumnData(nOldCol).AttrArray(); SCSIZE nIndex; - if ( pAttrArray->Count() ) - pAttrArray->Search( nOldRow, nIndex ); + if ( pAttrArray.Count() ) + pAttrArray.Search( nOldRow, nIndex ); else nIndex = 0; SCROW nAttrPos = nOldRow; while (nAttrPos<=nEndRow) { - OSL_ENSURE( nIndex < pAttrArray->Count(), "Wrong index in AttrArray" ); + OSL_ENSURE( nIndex < pAttrArray.Count(), "Wrong index in AttrArray" ); bool bHorOverlapped; - if ( pAttrArray->Count() ) - bHorOverlapped = pAttrArray->mvData[nIndex].pPattern->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped(); + if ( pAttrArray.Count() ) + bHorOverlapped = pAttrArray.mvData[nIndex].pPattern->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped(); else bHorOverlapped = GetDefPattern()->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped(); if ( bHorOverlapped ) { - SCROW nEndRowSeg = (pAttrArray->Count()) ? pAttrArray->mvData[nIndex].nEndRow : MaxRow(); + SCROW nEndRowSeg = (pAttrArray.Count()) ? pAttrArray.mvData[nIndex].nEndRow : MaxRow(); SCROW nLoopEndRow = std::min( nEndRow, nEndRowSeg ); for (SCROW nAttrRow = nAttrPos; nAttrRow <= nLoopEndRow; nAttrRow++) { @@ -5580,9 +5580,9 @@ void ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow, rStartCol = nTempCol; } } - if ( pAttrArray->Count() ) + if ( pAttrArray.Count() ) { - nAttrPos = pAttrArray->mvData[nIndex].nEndRow + 1; + nAttrPos = pAttrArray.mvData[nIndex].nEndRow + 1; ++nIndex; } else |