You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by hd...@apache.org on 2012/06/14 10:16:41 UTC

svn commit: r1350123 - /incubator/ooo/trunk/main/vcl/unx/generic/fontmanager/helper.cxx

Author: hdu
Date: Thu Jun 14 08:16:41 2012
New Revision: 1350123

URL: http://svn.apache.org/viewvc?rev=1350123&view=rev
Log:
#c706171# handle invalid PFB chunk header

Modified:
    incubator/ooo/trunk/main/vcl/unx/generic/fontmanager/helper.cxx

Modified: incubator/ooo/trunk/main/vcl/unx/generic/fontmanager/helper.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/unx/generic/fontmanager/helper.cxx?rev=1350123&r1=1350122&r2=1350123&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/unx/generic/fontmanager/helper.cxx (original)
+++ incubator/ooo/trunk/main/vcl/unx/generic/fontmanager/helper.cxx Thu Jun 14 08:16:41 2012
@@ -250,7 +250,7 @@ OUString psp::getFontPath()
 
 bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile )
 {
-    static unsigned char hexDigits[] =
+    static const unsigned char hexDigits[] =
         {
             '0', '1', '2', '3', '4', '5', '6', '7',
             '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
@@ -266,10 +266,12 @@ bool psp::convertPfbToPfa( ::osl::File& 
     while( bSuccess && ! bEof )
     {
         // read leading bytes
-        bEof = ! rInFile.read( buffer, 6, nRead ) && nRead == 6 ? false : true;
+        bEof = ((0 != rInFile.read( buffer, 6, nRead)) || (nRead != 6));
+        if( bEof )
+            break;
         unsigned int nType = buffer[ 1 ];
         unsigned int nBytesToRead = buffer[2] | buffer[3] << 8 | buffer[4] << 16 | buffer[5] << 24;
-        if( buffer[0] != 0x80 ) // test for pfb m_agic number
+        if( buffer[0] != 0x80 ) // test for pfb magic number
         {
             // this migt be a pfa font already
             sal_uInt64 nWrite = 0;