summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2018-02-27 17:47:19 +0100
committerDavid Tardon <dtardon@redhat.com>2018-02-27 19:10:08 +0100
commit9534a8fe3e84bfcc7d0d2addac4dd8cd96746d99 (patch)
treeb66419e39e5c7d604ec90994ffb192d7ae94633f /writerperfect
parent0808618e0df0fab4479917e588c096bc8770c6c5 (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
Diffstat (limited to 'writerperfect')
-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 c44175e5f485..83ea69cc348b 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;