sal/osl/unx/profile.cxx | 9 +++++---- sw/source/core/docnode/ndsect.cxx | 10 ++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-)
New commits: commit fb1d5274bf4669692a500005416e300d10d77270 Author: Caolán McNamara <[email protected]> AuthorDate: Mon Aug 26 20:57:37 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Aug 30 12:37:37 2024 +0200 cid#1606821 silence Overflowed constant Change-Id: I7766f17113f83f849289e50524aeb63503bc4c93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172639 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 6a1f091b7c22..177dcfd9d37d 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -1416,8 +1416,14 @@ OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const { // Calculate the Number and reset the Flag nNum = o3tl::toInt32(rNm.subView( aName.getLength() )); - if( nNum-- && nNum < mpSectionFormatTable->size() ) - pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); + if (nNum) + { + --nNum; + if (nNum < mpSectionFormatTable->size()) + { + pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); + } + } } if( pChkStr && *pChkStr==rNm ) pChkStr = nullptr; commit 4570a7cebdebf9ac89c0c23971f68bde2f2de608 Author: Caolán McNamara <[email protected]> AuthorDate: Thu Aug 29 20:29:27 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Aug 30 12:37:30 2024 +0200 cid#1606819 silence Overflowed array index write Change-Id: I349ee3b02d25b43571c66ae9dcfcaa1e7dbea8e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172638 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx index 1e7512a24db4..f756d55bec42 100644 --- a/sal/osl/unx/profile.cxx +++ b/sal/osl/unx/profile.cxx @@ -1048,7 +1048,7 @@ static bool OslProfile_rewindFile(osl_TFile* pFile, bool bTruncate) static char* OslProfile_getLine(osl_TFile* pFile) { - int Max, Free, nLineBytes = 0; + ssize_t Max, nLineBytes = 0; char* pChr; char* pLine = nullptr; char* pNewLine; @@ -1063,7 +1063,7 @@ static char* OslProfile_getLine(osl_TFile* pFile) do { - int Bytes = sizeof(pFile->m_ReadBuf) - (pFile->m_pReadPtr - pFile->m_ReadBuf); + ssize_t Bytes = sizeof(pFile->m_ReadBuf) - (pFile->m_pReadPtr - pFile->m_ReadBuf); if (Bytes <= 1) { @@ -1071,9 +1071,10 @@ static char* OslProfile_getLine(osl_TFile* pFile) memcpy(pFile->m_ReadBuf, pFile->m_pReadPtr, Bytes); pFile->m_pReadPtr = pFile->m_ReadBuf; - Free = sizeof(pFile->m_ReadBuf) - Bytes; + ssize_t Free = sizeof(pFile->m_ReadBuf) - Bytes; - if ((Max = read(pFile->m_Handle, &pFile->m_ReadBuf[Bytes], Free)) < 0) + Max = read(pFile->m_Handle, &pFile->m_ReadBuf[Bytes], Free); + if (Max < 0) { SAL_INFO("sal.osl", "read failed: " << UnixErrnoString(errno));
