cid#1607047 Overflowed integer argument

Change-Id: I60c991ba32c85ed872c6086104774259d1ac3b24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177239
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-11-08 17:49:52 +00:00
parent 81a6c8704f
commit c20db9a219

View file

@ -580,10 +580,11 @@ void ScColumn::AttachFormulaCells( sc::StartListeningContext& rCxt, SCROW nRow1,
{
nRow1 = std::min( nRow1, rCell.GetSharedTopRow());
SCROW nCellLen = rCell.GetSharedLength();
assert(nCellLen > 0);
if (nRow2 < rCell.GetSharedTopRow() + nCellLen)
// coverity[ tainted_data_return : FALSE ] version 2023.12.2
const auto nEndRow = rCell.GetSharedTopRow() + nCellLen;
if (nRow2 < nEndRow)
{
nRow2 = rCell.GetSharedTopRow() + nCellLen - 1;
nRow2 = nEndRow - 1;
bEnlargedDown = true;
// Same end row is also enlarged, i.e. doesn't need to be
// checked for another group.