fix pointer arithmetic in SvMemoryStream::PutData

after
  commit fa002b6244
  Author: Noel Grandin <noelgrandin@gmail.com>
  Date:   Sat Feb 21 21:00:32 2026 +0200
  fix asan heap-use-after-free

Change-Id: I2ed04d2957089f2e6968ac63b14639e27709295c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200400
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2026-02-26 13:50:59 +01:00
parent 507e1aeadf
commit 9ff0df208b
+1 -1
View File
@@ -1646,7 +1646,7 @@ std::size_t SvMemoryStream::PutData( const void* pData, std::size_t nCount )
}
else
{
const bool bSourceDataIsInsideBuffer = pData >= pBuf && pData <= (pBuf + nSize);
const bool bSourceDataIsInsideBuffer = pData >= pBuf && pData < (pBuf + nSize);
std::ptrdiff_t const offset = bSourceDataIsInsideBuffer ? static_cast<const char*>(pData) - reinterpret_cast<const char*>(pBuf) : 0;
tools::Long nNewResize;
if( nSize && nSize > nResize )