Commits

Philipp Lohmann [pl]  committed c3cec22

ooo34gsl02: #i117807# fix an off by one error (index actually inside the pfb section header)

  • Participants
  • Parent commits 315be82

Comments (0)

Files changed (1)

File vcl/source/gdi/pdfwriter_impl.cxx

             sal_Int32 nLength3 = nFontLen - nIndex;
             for( it = aSections.begin(); it != aSections.end(); ++it )
             {
-                if( *it >= nIndex  )
+                // special case: nIndex inside a section marker
+                if( nIndex >= (*it) && (*it)+6 > nIndex )
+                    nLength3 -= (*it)+6 - nIndex;
+                else if( *it >= nIndex  )
                 {
-                // special case: nIndex inside a section marker
-                    if( nIndex >= (*it) && (*it)+5 > nIndex )
-                        nLength3 -= (*it)+5 - nIndex;
-                    else
-                    {
-                        if( *it < nFontLen - 6 )
-                            nLength3 -= 6;
-                        else // the last section 0x8003 is only 2 bytes after all
-                            nLength3 -= (nFontLen - *it);
-                    }
+                    if( *it < nFontLen - 6 )
+                        nLength3 -= 6;
+                    else // the last section 0x8003 is only 2 bytes after all
+                        nLength3 -= (nFontLen - *it);
                 }
             }