diff options
author | Justin Luth <justin_luth@sil.org> | 2022-02-09 20:17:53 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2022-02-16 21:21:44 +0100 |
commit | 0b59601e415d186565278289e4d3613f727ef75c (patch) | |
tree | bbde8605ed0da8cd9421cc140545ba116ee59005 /sc | |
parent | d0ba468e271ee29298a812c0802b760d810056b9 (diff) |
tdf#113785 sc: IsDataFiltered must be normalized
I can't believe this hasn't caused major issues
and has survived as a bug for so long.
Due to the way IsDataFiltered is coded,
it is required that the range is normalized
in order to get any kind of meaningful result,
so lets ensure that.
Change-Id: I2ede77f738fbaeb05a0f1425a2e88e59fca08e9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129735
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
(cherry picked from commit bda200a5e9c4592bd61b7924fa171ec3265bfd24)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129761
Reviewed-by: Eike Rathke <erack@redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130049
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/table2.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 95bef419c9a8..7ed03187b4b4 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -3665,6 +3665,8 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow) bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const { + assert(nColStart <= nColEnd && nRowStart <= nRowEnd + && "range must be normalized to obtain a valid result"); for (SCROW i = nRowStart; i <= nRowEnd; ++i) { if (RowHidden(i)) @@ -3680,8 +3682,9 @@ bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SC bool ScTable::IsDataFiltered(const ScRange& rRange) const { - return IsDataFiltered(rRange.aStart.Col(), rRange.aStart.Row(), - rRange.aEnd.Col(), rRange.aEnd.Row()); + ScRange aNormalized(rRange.aStart, rRange.aEnd); + return IsDataFiltered(aNormalized.aStart.Col(), aNormalized.aStart.Row(), + aNormalized.aEnd.Col(), aNormalized.aEnd.Row()); } void ScTable::SetRowFlags( SCROW nRow, CRFlags nNewFlags ) |