Bug 691121

Summary: gs stops in interpreting tt instructions
Product: Ghostscript Reporter: Andrey V. Panov <panov>
Component: Font APIAssignee: Ken Sharp <ken.sharp>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: 8.71   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: testcase

Description Andrey V. Panov 2010-02-18 23:13:05 UTC
gs stops in interpreting tt instructions of glyphs U+0419 (&#1049;) or U+0439 (&#1081;) from the 
attached pdf file. This font is rendered by freetype, Adobe reader or MS Windows 
without issues. Here are error message:

GPL Ghostscript 8.71: Failed to interpret TT instructions for glyph index 8 of font 
Istok-Regular. Continue ignoring instructions of the font.
Comment 1 Andrey V. Panov 2010-02-18 23:14:19 UTC
Created attachment 5969 [details]
testcase
Comment 2 Alex Cherepanov 2010-02-23 19:53:40 UTC
This problem is already solved in the current version of FreeType.
An out-of-bounds request in Ins_MDRP() is silently ignored.

  static void Ins_MDRP( INS_ARG )
  {
    // [snip]
    if ( BOUNDS( point,      CUR.zp1.n_points ) ||
         BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
    {
      if ( CUR.pedantic_hinting )
        CUR.error = TT_Err_Invalid_Reference;
      return;
    }
    // snip  
}

Ghostscript should do the same and upgrade FreeType ASAP.
Comment 3 Ken Sharp 2010-02-24 00:28:41 UTC
Alex, thanks for the analysis I'll try and add code to ignore the out of bounds
error. The version of FreeType in Subversion is pretty new, only a week or so
old, do we need a newer one ?
Comment 4 Alex Cherepanov 2010-02-24 05:42:44 UTC
FreeType 2.3.12 has been released on 2010-Feb-13.
See http://freetype.sourceforge.net/index2.html
Comment 5 Ken Sharp 2010-02-24 05:58:15 UTC
The released FT code is practically identical with the code in the source
repository. In fact the one in Subversion is probably better for our purposes,
since it includes a fix for TrueType fonts which was added after the release of
FreeType 2.3.12 and fixes several issues (see bug #690448)

Revision 10794 fixes this in the regular Ghostscript TrueType interpreter, patch
here:

http://ghostscript.com/pipermail/gs-cvs/2010-February/010542.html