summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 71378a6db2ee..4ba5e2c8a319 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];