From 03408ce73d003ed4e58e3f8472f9445e72b86bee Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 18 Jan 2012 21:28:34 -0500 Subject: [PATCH] Fix more possible buffer overruns I have this function, but can't clean up it to my satisfaction. --- src/hb-ot-layout-gsubgpos-private.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index f1d03dc9b..13386c22e 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -317,12 +317,14 @@ static inline bool apply_lookup (hb_apply_context_t *c, */ for (unsigned int i = 0; i < count; /* NOP */) { + if (unlikely (c->buffer->idx == end)) + return true; while (c->should_mark_skip_current_glyph ()) { - if (unlikely (c->buffer->idx == end)) - return true; /* No lookup applied for this index */ c->buffer->next_glyph (); + if (unlikely (c->buffer->idx == end)) + return true; } if (lookupCount && i == lookupRecord->sequenceIndex)