GNOME Bugzilla – Bug 171170
Wrong return core in Do_Glyph_Lookup causes infinite loops
Last modified: 2005-07-26 18:35:27 UTC
In opentype code in both ftxgsub.c and ftxgpos.c, Do_Glyph_Lookup is supposed to return TTO_Err_Not_Covered if a lookup is not performed, but if the LookupType is out of range, then a TT_Err_Ok is returned. This bug hit when trying to use font Nesf2. The dump of the font doesn't look bad, but debugging shows a LookupType of 17 in the memory, so I expect to find another bug which is causing that, but this bug is a bug and should be fixed anyway. Note that my optimizations in bug 170414 fix this bug too.
Created attachment 39048 [details] [review] Patch to fix. The patch is trivial. Please apply to HEAD and branches.
Created attachment 39049 [details] [review] New patch. Ok, the other problem is that if a font contains a lookup index for which no lookup exists, the lookup should be ignored. This patch contains both fixes and obsoletes the first patch.
The patches look OK to me, but see also: TT_{GSUB,GPOS}_Add_Feature and (for lookup indices coming from other places) Do_ContextSubst, Do_ContextPos If you do the latter two, you probably can close bug 161327, since we don't really need to check when loading *and* when applying the features.
Created attachment 49782 [details] [review] Revised patch. Checks are done at every point we lookup a lookup :)
Applied your patch with one change - you didn't have a check in ftxpos.c:Do_Glyph_Lookup() 2005-07-26 Owen Taylor <otaylor@redhat.com> * pango/opentype/ftxgsub.c, pango/opentype/ftxgpos.c: Skip lookups with lookup index out of range. (Patch from Behdad Esfahbod, #171170)
*** Bug 161327 has been marked as a duplicate of this bug. ***