sc/source/core/data/table3.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b9bdb81f3a9019a4c6c1758d980c5c26653831a3
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Mar 8 12:59:47 2022 +0100
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Tue Mar 8 17:03:11 2022 +0100

    proper columns range check (tdf#147830)
    
    Change-Id: Ib23bc3f194fa418035e7c70a4f3e1b682f9c46b8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131181
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>
    (cherry picked from commit d032b81bbf2ca87114d15749d74166d0ba414972)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131194
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 7ccae5442178..efcc910dc696 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2696,7 +2696,7 @@ bool ScTable::CreateExcelQuery(SCCOL nCol1, SCROW nRow1, 
SCCOL nCol2, SCROW nRow
     if (bValid)
     {
         sal_uLong nVisible = 0;
-        for ( nCol=nCol1; nCol<=nCol2; nCol++ )
+        for ( nCol=nCol1; nCol<=ClampToAllocatedColumns(nCol2); nCol++ )
             nVisible += aCol[nCol].VisibleCount( nRow1+1, nRow2 );
 
         if ( nVisible > SCSIZE_MAX / sizeof(void*) )

Reply via email to