vcl/unx/generic/printer/ppdparser.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 7b9db1b3b7a866613b33ac05a0362109530e97ea
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Jun 26 15:03:51 2018 +0100

    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 <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

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;
     }
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to