[Libreoffice-commits] core.git: vcl/generic

Herbert Dürr hdu at apache.org
Thu Mar 7 02:18:57 PST 2013


 vcl/generic/fontmanager/helper.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit f9e73b74bc61fcf410d25b9087bf123d5e3e13f6
Author: Herbert Dürr <hdu at apache.org>
Date:   Thu Jun 14 07:16:41 2012 +0000

    c#706171# handle invalid PFB chunk header
    
    Conflicts:
    	vcl/unx/generic/fontmanager/helper.cxx
    
    Change-Id: I2d58b83c51a2c8b529727be0aeb5ef612f883acc

diff --git a/vcl/generic/fontmanager/helper.cxx b/vcl/generic/fontmanager/helper.cxx
index 414c82f..25c1c4f 100644
--- a/vcl/generic/fontmanager/helper.cxx
+++ b/vcl/generic/fontmanager/helper.cxx
@@ -242,7 +242,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'
@@ -258,10 +258,12 @@ bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile )
     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
             if( ! rInFile.read( buffer+6, 9, nRead ) && nRead == 9 &&


More information about the Libreoffice-commits mailing list