diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-08-29 20:29:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-08-30 12:37:30 +0200 |
commit | 4570a7cebdebf9ac89c0c23971f68bde2f2de608 (patch) | |
tree | c69ff5cdd558868ef7122297dc66ee952d1206ca | |
parent | cid#1606757 Overflowed constant (diff) | |
download | core-4570a7cebdebf9ac89c0c23971f68bde2f2de608.tar.gz core-4570a7cebdebf9ac89c0c23971f68bde2f2de608.zip |
cid#1606819 silence Overflowed array index write
Change-Id: I349ee3b02d25b43571c66ae9dcfcaa1e7dbea8e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172638
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
-rw-r--r-- | sal/osl/unx/profile.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
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)); |