diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-26 15:03:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-26 21:37:50 +0200 |
commit | 7b9db1b3b7a866613b33ac05a0362109530e97ea (patch) | |
tree | b2ac7a16ff6a8ab982e384ef91fd83cc8ac6e4dd | |
parent | 8e908ed926354703a00e19669e3f2631ebb05497 (diff) |
forcepoint#50 fix end detection
rBuffer.size() of 26, nBytes of 25, rBuffer[25] is the first zero
so aLine.getLength() of 25, nBytes reduced by aLine.getLength()+1 and
nRun increased by same, so nBytes wraps and nRun is 26.
Change-Id: Ia9f4789e081e6b77a21321f37d71cabfc7c84550
Reviewed-on: https://gerrit.libreoffice.org/56478
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/unx/generic/printer/ppdparser.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index c333306bf0ef..af2dfbe0e249 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -1912,9 +1912,9 @@ void PPDContext::rebuildFromStreamBuffer(const std::vector<char> &rBuffer) m_aCurrentValues.clear(); - size_t nBytes = rBuffer.size() - 1; + const size_t nBytes = rBuffer.size() - 1; size_t nRun = 0; - while (nBytes && rBuffer[nRun]) + while (nRun < nBytes && rBuffer[nRun]) { OString aLine(rBuffer.data() + nRun); sal_Int32 nPos = aLine.indexOf(':'); @@ -1935,7 +1935,6 @@ void PPDContext::rebuildFromStreamBuffer(const std::vector<char> &rBuffer) << " }"); } } - nBytes -= aLine.getLength()+1; nRun += aLine.getLength()+1; } } |