Kaydet (Commit) 84d0b4fc authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#4806 Infinite loop

Change-Id: I89a24fa3ce4034ef207233b96c5e26a7b7787444
Reviewed-on: https://gerrit.libreoffice.org/47096Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 5d30798c
...@@ -539,6 +539,7 @@ public: ...@@ -539,6 +539,7 @@ public:
const sal_Int32 nBufSize = 8192; const sal_Int32 nBufSize = 8192;
sal_Int32 nRemaining = xSrcStream->available(); sal_Int32 nRemaining = xSrcStream->available();
sal_Int32 nRead = 0;
maBytes.reserve(nRemaining); maBytes.reserve(nRemaining);
uno::Sequence<sal_Int8> aBuf(nBufSize); uno::Sequence<sal_Int8> aBuf(nBufSize);
...@@ -552,10 +553,17 @@ public: ...@@ -552,10 +553,17 @@ public:
}; };
while (nRemaining > nBufSize) while (nRemaining > nBufSize)
nRemaining -= readAndCopy(nBufSize); {
const auto nBytes = readAndCopy(nBufSize);
if (!nBytes)
break;
nRead += nBytes;
nRemaining -= nBytes;
}
if (nRemaining) 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 virtual sal_Int32 SAL_CALL readBytes( uno::Sequence<sal_Int8>& rData, sal_Int32 nBytesToRead ) override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment