sc/source/core/data/table6.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit c690d7c3d49d887fab85f8040fa91965b4ab2781
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Sep 16 16:06:31 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Sep 16 22:07:50 2022 +0200

    cid#1513720 silence Improper use of negative value
    
    negative col doesn't seem to arise in this branch, seems it can only
    negative for the other direction and/or for styles which isn't handled
    in this method.
    
    Change-Id: I3a50ebef57a84e808a03fc677030acfd7605230d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140078
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 1915ad7c1588..1f0fc1efbf3d 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -482,6 +482,11 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, 
SCCOL& rCol, SCROW& rRow,
                     if (bSkipFiltered)
                         SkipFilteredRows(nRow, nLastNonFilteredRow, true);
 
+                    // GetSearchAndReplaceStart sets a nCol of -1 for
+                    // ColDirection() only if rSearchItem.GetPattern() is true,
+                    // so a negative column shouldn't be possible here.
+                    assert(nCol >= 0 && "negative nCol for ColDirection");
+
                     bFound = SearchCell(rSearchItem, nCol, blockPos[ nCol ],
                                         nRow, rMark, rUndoStr, pUndoDoc);
                     if (!bFound)

Reply via email to