From af913c5788e600e36d29f44fe4e77db84cf8c442 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 17 Oct 2011 11:39:28 -0700 Subject: [PATCH] Fix infinite loop in normalization code with variation selectors Reported by Jonathan Kew. --- src/hb-ot-shape-normalize.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc index 6d516c5a3..eb9f32ad1 100644 --- a/src/hb-ot-shape-normalize.cc +++ b/src/hb-ot-shape-normalize.cc @@ -143,8 +143,11 @@ decompose_multi_char_cluster (hb_ot_shape_context_t *c, { /* TODO Currently if there's a variation-selector we give-up, it's just too hard. */ for (unsigned int i = c->buffer->idx; i < end; i++) - if (unlikely (is_variation_selector (c->buffer->info[i].codepoint))) + if (unlikely (is_variation_selector (c->buffer->info[i].codepoint))) { + while (c->buffer->idx < end) + c->buffer->next_glyph (); return; + } while (c->buffer->idx < end) decompose_current_glyph (c, FALSE);