[subset] Bail out of context lookup expansion once the lookup limit is encountered.

This commit is contained in:
Garret Rieger 2020-03-31 16:29:29 -07:00 committed by Ebrahim Byagowi
parent 5d345d0cd1
commit 014e038b2c
2 changed files with 8 additions and 0 deletions

View File

@ -1397,6 +1397,8 @@ struct Rule
void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const
{ {
if (c->lookup_limit_exceeded ()) return;
const UnsizedArrayOf<LookupRecord> &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>> const UnsizedArrayOf<LookupRecord> &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
(inputZ.as_array ((inputCount ? inputCount - 1 : 0))); (inputZ.as_array ((inputCount ? inputCount - 1 : 0)));
context_closure_lookup (c, context_closure_lookup (c,
@ -1407,6 +1409,8 @@ struct Rule
void closure_lookups (hb_closure_lookups_context_t *c) const void closure_lookups (hb_closure_lookups_context_t *c) const
{ {
if (c->lookup_limit_exceeded ()) return;
const UnsizedArrayOf<LookupRecord> &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>> const UnsizedArrayOf<LookupRecord> &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
(inputZ.as_array (inputCount ? inputCount - 1 : 0)); (inputZ.as_array (inputCount ? inputCount - 1 : 0));
recurse_lookups (c, lookupCount, lookupRecord.arrayZ); recurse_lookups (c, lookupCount, lookupRecord.arrayZ);
@ -1485,6 +1489,8 @@ struct RuleSet
void closure (hb_closure_context_t *c, void closure (hb_closure_context_t *c,
ContextClosureLookupContext &lookup_context) const ContextClosureLookupContext &lookup_context) const
{ {
if (c->lookup_limit_exceeded ()) return;
return return
+ hb_iter (rule) + hb_iter (rule)
| hb_map (hb_add (this)) | hb_map (hb_add (this))
@ -1494,6 +1500,8 @@ struct RuleSet
void closure_lookups (hb_closure_lookups_context_t *c) const void closure_lookups (hb_closure_lookups_context_t *c) const
{ {
if (c->lookup_limit_exceeded ()) return;
return return
+ hb_iter (rule) + hb_iter (rule)
| hb_map (hb_add (this)) | hb_map (hb_add (this))