summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2021-01-20 12:21:43 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2021-01-22 15:08:47 +0100
commitdf8381d26bce330a67addbff95e9afec8dc07d79 (patch)
tree42fcebe1115b13230e066027aa9870831e64a0c3
parent4138d724ebb9150e053f9fcdfcf47ac621672618 (diff)
tdf#139782 sc: Don't try to access unallocated column
This fixes a regression from commit 7282014e362a1529a36c88eb308df8ed359c2cfa Date: Fri Feb 1 15:15:16 2019 +0100 tdf#50916 Makes numbers of columns dynamic. Change-Id: I12a780bf52024cef31188651813d3a93cc2b5ddd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109704 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 3032cf9df042f50511a15c6a627c50f708a34238) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109813 Tested-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--sc/source/core/data/dociter.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 5331e8ac33ae..975d1ad5335f 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1799,6 +1799,10 @@ bool ScQueryCellIterator::BinarySearch()
if (nTab >= pDoc->GetTableCount())
OSL_FAIL("try to access index out of bounds, FIX IT");
nCol = mpParam->nCol1;
+
+ if (nCol >= pDoc->maTabs[nTab]->GetAllocatedColumnsCount())
+ return false;
+
ScColumn* pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
if (pCol->IsEmptyData())
return false;