[subset] For [Chain]ContextFormat3 make sure the sub table intersects the retained glyphset before recursing to its lookups.

Otherwise the lookup closure will potentially pull in lookups which cannot be accessed via the retained glyph set.
This commit is contained in:
Garret Rieger 2020-09-25 14:57:20 -07:00
parent dc375559fd
commit a5c0ec7516
1 changed files with 5 additions and 0 deletions

View File

@ -1945,6 +1945,8 @@ struct ContextFormat3
void closure_lookups (hb_closure_lookups_context_t *c) const
{
if (!intersects (c->glyphs))
return;
const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
recurse_lookups (c, lookupCount, lookupRecord);
}
@ -2910,6 +2912,9 @@ struct ChainContextFormat3
void closure_lookups (hb_closure_lookups_context_t *c) const
{
if (!intersects (c->glyphs))
return;
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage>> (backtrack);
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage>> (input);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord>> (lookahead);