From 9534a8fe3e84bfcc7d0d2addac4dd8cd96746d99 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Tue, 27 Feb 2018 17:47:19 +0100 Subject: set number of read bytes correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was wrong if we read less than was expected. Thanks to Antti Levomäki and Christian Jalio from Forcepoint. Change-Id: I070c1731d1aace4c101fa01efed0c28734c44899 --- writerperfect/source/common/WPXSvInputStream.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'writerperfect') 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; -- cgit v1.2.3