From 0c1033a08eff36699d4ec1e8eea76a7d8b621cdf Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 8 Oct 2019 16:23:31 +0200 Subject: tools: don't leave SvStream::m_nBufFilePos pointing beyond the end ... of the stream in SvStream::SetStreamSize(); this caused SvMemoryStream with SetStreamSize(0) and subsequent write to be pre-filled with 0 bytes. Change-Id: I0de704b319f5087bc6c1914881e38018212afbf2 Reviewed-on: https://gerrit.libreoffice.org/80478 Tested-by: Jenkins Reviewed-by: Michael Stahl --- tools/source/stream/stream.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools') diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index a793446ce738..713d36504b6f 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1561,6 +1561,10 @@ bool SvStream::SetStreamSize(sal_uInt64 const nSize) sal_uInt16 nBuf = m_nBufSize; SetBufferSize( 0 ); SetSize( nSize ); + if (nSize < m_nBufFilePos) + { + m_nBufFilePos = nSize; + } SetBufferSize( nBuf ); #ifdef DBG_UTIL DBG_ASSERT(Tell()==nFPos,"SetStreamSize failed"); -- cgit