[Libreoffice-commits] .: vcl/source

Caolán McNamara caolan at kemper.freedesktop.org
Sat May 5 13:22:48 PDT 2012


 vcl/source/gdi/pdfwriter_impl2.cxx |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit c2003c73d71001fcb66fb86a15cde82e60aa242a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 5 21:19:24 2012 +0100

    Related: fdo#47511 valgrind: invalid read of size 1
    
    Change-Id: Icca307c1a9ac47201e4cd0069feb699bae2ae359

diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 71378a6..4ba5e2c 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -1666,12 +1666,20 @@ long findBitRun( const Scanline i_pLine, long i_nStartIndex, long i_nW, bool i_b
             pRunTable = unsetRun;
         }
 
-        while( nByte == nRunByte && nIndex < i_nW )
+        if( nIndex < i_nW )
         {
-            nIndex += 8;
-            pByte++;
-            nByte = *pByte;
+            while( nByte == nRunByte )
+            {
+                nIndex += 8;
+
+                if (nIndex >= i_nW)
+                    break;
+
+                pByte++;
+                nByte = *pByte;
+            }
         }
+
         if( nIndex < i_nW )
         {
             nIndex += pRunTable[nByte];


More information about the Libreoffice-commits mailing list