[Libreoffice-commits] core.git: package/source
Caolán McNamara
caolanm at redhat.com
Wed Dec 27 20:42:35 UTC 2017
package/source/zipapi/ZipFile.cxx | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
New commits:
commit 84d0b4fcfb74288a8ed22f7786db8368a9a0a807
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Dec 27 18:38:42 2017 +0000
ofz#4806 Infinite loop
Change-Id: I89a24fa3ce4034ef207233b96c5e26a7b7787444
Reviewed-on: https://gerrit.libreoffice.org/47096
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 61f7ea1dacc1..de4c1a364acd 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -539,6 +539,7 @@ public:
const sal_Int32 nBufSize = 8192;
sal_Int32 nRemaining = xSrcStream->available();
+ sal_Int32 nRead = 0;
maBytes.reserve(nRemaining);
uno::Sequence<sal_Int8> aBuf(nBufSize);
@@ -552,10 +553,17 @@ public:
};
while (nRemaining > nBufSize)
- nRemaining -= readAndCopy(nBufSize);
+ {
+ const auto nBytes = readAndCopy(nBufSize);
+ if (!nBytes)
+ break;
+ nRead += nBytes;
+ nRemaining -= nBytes;
+ }
if (nRemaining)
- readAndCopy(nRemaining);
+ nRead += readAndCopy(nRemaining);
+ maBytes.resize(nRead);
}
virtual sal_Int32 SAL_CALL readBytes( uno::Sequence<sal_Int8>& rData, sal_Int32 nBytesToRead ) override
More information about the Libreoffice-commits
mailing list