Fix more possible buffer overruns

I have this function, but can't clean up it to my satisfaction.
This commit is contained in:
Behdad Esfahbod 2012-01-18 21:28:34 -05:00
parent 7d479900cd
commit 03408ce73d
1 changed files with 4 additions and 2 deletions

View File

@ -317,12 +317,14 @@ static inline bool apply_lookup (hb_apply_context_t *c,
*/ */
for (unsigned int i = 0; i < count; /* NOP */) for (unsigned int i = 0; i < count; /* NOP */)
{ {
if (unlikely (c->buffer->idx == end))
return true;
while (c->should_mark_skip_current_glyph ()) while (c->should_mark_skip_current_glyph ())
{ {
if (unlikely (c->buffer->idx == end))
return true;
/* No lookup applied for this index */ /* No lookup applied for this index */
c->buffer->next_glyph (); c->buffer->next_glyph ();
if (unlikely (c->buffer->idx == end))
return true;
} }
if (lookupCount && i == lookupRecord->sequenceIndex) if (lookupCount && i == lookupRecord->sequenceIndex)