summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2018-02-27 17:47:19 +0100
committerMichael Stahl <mstahl@redhat.com>2018-02-27 20:41:48 +0100
commit1b1f416244ace9ab3eb532cc4ab242486cd1930d (patch)
treee59536f66ab6ff65d97073d5a9720894988dd507
parent7a1c0be8570e2be4a11f3e17c48c140b62245faa (diff)
set number of read bytes correctly
It was wrong if we read less than was expected. Thanks to Antti Levomäki and Christian Jalio from Forcepoint. Change-Id: I070c1731d1aace4c101fa01efed0c28734c44899 (cherry picked from commit 9534a8fe3e84bfcc7d0d2addac4dd8cd96746d99) Reviewed-on: https://gerrit.libreoffice.org/50463 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--writerperfect/source/common/WPXSvInputStream.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx
index c3e4477781e7..54204cf60768 100644
--- a/writerperfect/source/common/WPXSvInputStream.cxx
+++ b/writerperfect/source/common/WPXSvInputStream.cxx
@@ -877,7 +877,10 @@ const unsigned char *WPXSvInputStream::read(unsigned long numBytes, unsigned lon
if (!mpImpl->mnReadBufferLength)
return nullptr;
- numBytesRead = numBytes;
+ if (numBytes <= mpImpl->mnReadBufferLength)
+ numBytesRead = numBytes;
+ else
+ numBytesRead = mpImpl->mnReadBufferLength;
mpImpl->mnReadBufferPos += numBytesRead;
return mpImpl->mpReadBuffer;