提交 49901862 编写于 作者: B Behdad Esfahbod

[otlayout] Guard against use of ReverseChain through Context

上级 74f4bbf0
...@@ -1037,7 +1037,9 @@ struct ReverseChainSingleSubstFormat1 ...@@ -1037,7 +1037,9 @@ struct ReverseChainSingleSubstFormat1
1)) 1))
{ {
c->replace_glyph_inplace (substitute[index]); 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); return TRACE_RETURN (true);
} }
......
...@@ -867,8 +867,8 @@ apply_string (OT::hb_apply_context_t *c, ...@@ -867,8 +867,8 @@ apply_string (OT::hb_apply_context_t *c,
(c->buffer->cur().mask & c->lookup_mask) && (c->buffer->cur().mask & c->lookup_mask) &&
apply_once (c, lookup)) apply_once (c, lookup))
ret = true; ret = true;
else /* The reverse lookup doesn't "advance" cursor (for good reason). */
c->buffer->idx--; c->buffer->idx--;
} }
while ((int) c->buffer->idx >= 0); while ((int) c->buffer->idx >= 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册