[morx] Break out if buffer gets into error

Was getting stuck not making progress somehow.
This commit is contained in:
Behdad Esfahbod 2018-10-01 12:10:00 +02:00
parent df827a6ab8
commit 98ac01d3b3
2 changed files with 6 additions and 0 deletions

View File

@ -585,6 +585,8 @@ struct StateTableDriver
if (unlikely (!c->transition (this, entry))) if (unlikely (!c->transition (this, entry)))
break; break;
if (unlikely (!buffer->successful)) return;
last_was_dont_advance = (entry->flags & context_t::DontAdvance) && buffer->max_ops-- > 0; last_was_dont_advance = (entry->flags & context_t::DontAdvance) && buffer->max_ops-- > 0;
state = entry->newState; state = entry->newState;

View File

@ -886,6 +886,8 @@ struct Chain
(void) c->buffer->message (c->font, "end chain subtable %d", c->lookup_index); (void) c->buffer->message (c->font, "end chain subtable %d", c->lookup_index);
if (unlikely (!c->buffer->successful)) return;
skip: skip:
subtable = &StructAfter<ChainSubtable> (*subtable); subtable = &StructAfter<ChainSubtable> (*subtable);
c->set_lookup_index (c->lookup_index + 1); c->set_lookup_index (c->lookup_index + 1);
@ -942,12 +944,14 @@ struct morx
inline void apply (hb_aat_apply_context_t *c) const inline void apply (hb_aat_apply_context_t *c) const
{ {
if (unlikely (!c->buffer->successful)) return;
c->set_lookup_index (0); c->set_lookup_index (0);
const Chain *chain = &firstChain; const Chain *chain = &firstChain;
unsigned int count = chainCount; unsigned int count = chainCount;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
chain->apply (c); chain->apply (c);
if (unlikely (!c->buffer->successful)) return;
chain = &StructAfter<Chain> (*chain); chain = &StructAfter<Chain> (*chain);
} }
} }