summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-05-05 21:19:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-05-05 21:22:21 +0100
commitc2003c73d71001fcb66fb86a15cde82e60aa242a (patch)
treea8381bf10f7ffbc4ff96f0e3d60cfcfc851f2168
parentf1005e50e795a06b5504960a94e529b48e085a91 (diff)
Related: fdo#47511 valgrind: invalid read of size 1
Change-Id: Icca307c1a9ac47201e4cd0069feb699bae2ae359
-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];