summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-08-29 00:29:35 +0200
committerMichael Stahl <mstahl@redhat.com>2015-08-31 16:37:17 +0200
commit6a223b9acf8571e098cc6f74edcd3060d3fcfe27 (patch)
treef8925169573ccec98414ad64c6daaa6c21bc6a10 /tools
parent0c191e2b757555b147ebab1688e72acde28062a1 (diff)
sot: don't leak uninitialized memory into temp file
Both valgrind and drmemory complain about this in SdExportTest::testSwappedOutImageExport() via SfxOleThumbnailProperty::ImplSave(). Syscall param pwrite64(buf) points to uninitialised byte(s) UNINITIALIZED READ: reading 0x0455b1b4-0x0455b1c8 20 byte(s) within... It appears that the stream writes out everything up to the seek position anyway (otherwise the size check wouldn't work, with sparse files) so make sure it's all zeroed. Also fix SvMemoryStream::ReAllocateMemory() to zero it. Change-Id: Id86dfa65ef6f7d1bba4810f121e01473c5fcf4c7
Diffstat (limited to 'tools')
-rw-r--r--tools/source/stream/stream.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 88b320edc63e..da91a21a6b82 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1899,9 +1899,13 @@ bool SvMemoryStream::ReAllocateMemory( long nDiff )
if( nEndOfData >= nNewSize )
nEndOfData = nNewSize-1L;
}
- else if (nSize != 0)
+ else
{
- memcpy( pNewBuf, pBuf, (size_t)nSize );
+ if (nSize != 0)
+ {
+ memcpy( pNewBuf, pBuf, (size_t)nSize );
+ }
+ memset(pNewBuf + nSize, 0x00, nNewSize - nSize);
}
FreeMemory();