We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d18fd3f commit 85be877Copy full SHA for 85be877
src/hb-ot-layout-gsubgpos.hh
@@ -578,6 +578,13 @@ struct hb_ot_apply_context_t :
578
unsigned stop = num_items - 1;
579
if (c->buffer->flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT)
580
stop = 1 - 1;
581
+
582
+ /* When looking back, limit how far we search; this function is mostly
583
+ * used for looking back for base glyphs when attaching marks. If we
584
+ * don't limit, we can get O(n^2) behavior where n is the number of
585
+ * consecutive marks. */
586
+ stop = (unsigned) hb_max ((int) stop, (int) idx - HB_MAX_CONTEXT_LENGTH);
587
588
while (idx > stop)
589
{
590
idx--;
0 commit comments