From 98ac01d3b3deb7c7f5411f6f25c6e7588d84b5f9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Oct 2018 12:10:00 +0200 Subject: [PATCH] [morx] Break out if buffer gets into error Was getting stuck not making progress somehow. --- src/hb-aat-layout-common.hh | 2 ++ src/hb-aat-layout-morx-table.hh | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 052aad7fc..b0faa1db5 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -585,6 +585,8 @@ struct StateTableDriver if (unlikely (!c->transition (this, entry))) break; + if (unlikely (!buffer->successful)) return; + last_was_dont_advance = (entry->flags & context_t::DontAdvance) && buffer->max_ops-- > 0; state = entry->newState; diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 60d05e61a..c58e6744d 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -886,6 +886,8 @@ struct Chain (void) c->buffer->message (c->font, "end chain subtable %d", c->lookup_index); + if (unlikely (!c->buffer->successful)) return; + skip: subtable = &StructAfter (*subtable); c->set_lookup_index (c->lookup_index + 1); @@ -942,12 +944,14 @@ struct morx inline void apply (hb_aat_apply_context_t *c) const { + if (unlikely (!c->buffer->successful)) return; c->set_lookup_index (0); const Chain *chain = &firstChain; unsigned int count = chainCount; for (unsigned int i = 0; i < count; i++) { chain->apply (c); + if (unlikely (!c->buffer->successful)) return; chain = &StructAfter (*chain); } }