summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2018-02-27 17:47:19 +0100
committerAndras Timar <andras.timar@collabora.com>2018-03-06 16:44:49 +0100
commite73f36315d02b328f3227bc72af8b4868a2c9192 (patch)
treead766e7766c9725e8efcdba8c7dfc35f40d7415b
parentf31361a7721a071257b77f57268259a8bf94be86 (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> (cherry picked from commit 1b1f416244ace9ab3eb532cc4ab242486cd1930d)
-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 ddb976b94018..c6e41c7326fc 100644
--- a/writerperfect/source/common/WPXSvInputStream.cxx
+++ b/writerperfect/source/common/WPXSvInputStream.cxx
@@ -869,7 +869,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;