[Libreoffice-commits] core.git: tools/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 9 13:30:12 UTC 2019


 tools/source/stream/stream.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 0c1033a08eff36699d4ec1e8eea76a7d8b621cdf
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Oct 8 16:23:31 2019 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Oct 9 15:28:49 2019 +0200

    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 <michael.stahl at cib.de>

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");


More information about the Libreoffice-commits mailing list