freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] More fuzzing for freetype2?


From: Werner LEMBERG
Subject: Re: [ft-devel] More fuzzing for freetype2?
Date: Wed, 07 Oct 2015 11:55:07 +0200 (CEST)

> How do you identify that a given file belongs to one format or
> another?  Some magic in the beginning?

This works in many cases, yes.

> We can modify the target function to immediately reject all formats
> but one, and we'll get what you are asking for.  This is where my
> knowledge about this domain area (fonts) ends and where I may need
> your help.

Some strings at the very beginning of a file can identify font formats
with quite a good probability.  Here some regular expressions (to be
applied on a byte stream, not a character stream).


  "%!FontType1"                      PS Type 1 ASCII (PFA)
  "......%!FontType1"                PS Type 1 Binary (PFB)
  "%!PS-AdobeFont-1."                PS Type 1 ASCII or Multiple
                                       Masters (PFA) 
  "......%!PS-AdobeFont-1."          PS Type 1 Binary or Multiple
                                       Masters (PFB)
  "%!PS-Adobe-3.0 Resource-CIDFont"  PS CID-keyed font
  "%!PS-TrueTypeFont-1"              PS Type 42
  "STARTFONT "                       BDF
  "\x01fcp"                          PCF
  "\x1F\x8B"                         gzip compressed font -> PCF
  "\x1F\x9D"                         compressed font -> PCF
  "BZh"                              bzip2 compressed font -> PCF
  "OTTO"                             CFF (or SING gaiji) in an SFNT
                                       container
  "\x00\x01\x00\x00"                 TTF (both outline and bitmaps)
  "true"                             TTF (for Macs)
  "ttcf"                             font collection (either TrueType
                                       or CFF in SFNT container format)
  "wOFF"                             WOFF
  "wOF2"                             WOFF 2 (not supported yet)
  "PFR0"                             PFR
  "\x00\x00\x01\x00"                 TrueType suitcase (or any other
                                       Apple suitcase)
  "MZ"                               Windows bitmap font resource (or
                                       any other Windows resource)


Note that raw CFF files (often present in PDF files) don't have a
signature; they can only be identified by parsing.


    Werner



reply via email to

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