diff options
author | David Tardon <dtardon@redhat.com> | 2018-02-27 17:47:19 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2018-02-27 20:41:22 +0100 |
commit | f3c742dca6b304da8557f5ca9fb5c287cf5ac934 (patch) | |
tree | c0726d6906f6fc5d7f8b1c3a512662c15ac7b2fa /writerperfect | |
parent | 0ad7f0ceb897963b5e2051bf86009e97fc81a300 (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/50462
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/source/common/WPXSvInputStream.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index 75a56b35fa78..7483a28dbee4 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; |