[otlayout] Guard against use of ReverseChain through Context

This commit is contained in:
Behdad Esfahbod 2013-10-17 19:48:51 +02:00
parent 74f4bbf056
commit 49901862e3
2 changed files with 5 additions and 3 deletions

View File

@ -1037,7 +1037,9 @@ struct ReverseChainSingleSubstFormat1
1))
{
c->replace_glyph_inplace (substitute[index]);
c->buffer->idx--; /* Reverse! */
/* Note: We DON'T decrease buffer->idx. The main loop does it
* for us. This is useful for preventing surprises if someone
* calls us through a Context lookup. */
return TRACE_RETURN (true);
}

View File

@ -867,8 +867,8 @@ apply_string (OT::hb_apply_context_t *c,
(c->buffer->cur().mask & c->lookup_mask) &&
apply_once (c, lookup))
ret = true;
else
c->buffer->idx--;
/* The reverse lookup doesn't "advance" cursor (for good reason). */
c->buffer->idx--;
}
while ((int) c->buffer->idx >= 0);