freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] pfb parsing error


From: David Bevan
Subject: [Devel] pfb parsing error
Date: Fri, 19 Sep 2003 11:50:05 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0

Hi!

In FreeType 2.1.5, read_pfb_tag() in t1parse.c has an error. If it comes across the 0x8003 end-of-file indicator it seeks to read 6 bytes when only 2 are available, and fails when it should succeed.

As a result, FreeType failed to read some binary Type 1 (*.pfb) files. (I can send a sample file somewhere if desired.)

Replacement code for read_pfb_tag() is below; pfb_tag_fields[] is no longer used.

Thanks.

David %^>


  static FT_Error
  read_pfb_tag( FT_Stream   stream,
                FT_UShort*  tag,
                FT_Long*    size )
  {
    FT_Error  error;
    PFB_Tag   head;

    *tag  = 0;
    *size = 0;

    if ( !FT_READ_USHORT( head.tag ) )
    {
      if ( head.tag == 0x8001U || head.tag == 0x8002U )
      {
        if ( !FT_READ_LONG_LE( head.size ) )
          *size = head.size;
      }

      *tag = head.tag;
    }

    return error;
  }


--
 ________________________________________________________
 David Bevan, Emtex Ltd.
 Emtex House, Station Road, Kings Langley, Herts. WD4 8LH England
 Tel:    +44 (0)1923 270882
 E-mail: address@hidden
 Web:    www.emtex.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]