diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-02-07 10:30:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-02-07 11:41:30 +0000 |
commit | e7897ce47e415e46eb36687f911a9a4b09ca6b8a (patch) | |
tree | 881f26742ca953c69998d660929182b9dbfe6764 /sc | |
parent | 6275bd9db475cb984ac153d06ed1ddadfa2fadb7 (diff) |
crashtesting: crash in ScInterpreter::ScCountIfs
seen on importing forum-mso-en4-253817.xls and others
Error: attempt to advance a dereferenceable (start-of-sequence) iterator
which falls outside its valid range.
presumably since:
commit 7674399aac661eb503d7badc53b9a4d68bd9839d
Date: Fri May 27 19:51:40 2022 +0200
try to range-reduce even COUNTIFS if not matching empty cells
bodge this to fill in 0 for missing ranges
Change-Id: If77d8ab887859f11b240975bb837a27785f500a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146604
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index d82acb37494c..06bf2b44ed65 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -6134,8 +6134,14 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf { newConditions.insert( newConditions.end(), nStartRowDiff, 0 ); SCCOL oldCol = col - ( nCol1 + nStartColDiff ); - auto it = vConditions.begin() + oldCol * nDimensionRows; - newConditions.insert( newConditions.end(), it, it + nDimensionRows ); + size_t nIndex = oldCol * nDimensionRows; + if (nIndex < vConditions.size()) + { + auto it = vConditions.begin() + nIndex; + newConditions.insert( newConditions.end(), it, it + nDimensionRows ); + } + else + newConditions.insert( newConditions.end(), nDimensionRows, 0 ); newConditions.insert( newConditions.end(), -nEndRowDiff, 0 ); } for(; col <= nCol2; ++col) |