diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index c731ed189..5f320bd7e 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -407,6 +407,8 @@ hb_buffer_t::move_to (unsigned int i) idx = i; return true; } + if (unlikely (in_error)) + return false; assert (i <= out_len + (len - idx)); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index d6db00566..3f9d9ca9d 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -971,7 +971,7 @@ static inline bool apply_lookup (hb_apply_context_t *c, match_positions[j] += delta; } - for (unsigned int i = 0; i < lookupCount; i++) + for (unsigned int i = 0; i < lookupCount && !buffer->in_error; i++) { unsigned int idx = lookupRecord[i].sequenceIndex; if (idx >= count)