[khmer] Fix infinite-loop in cluster merging
Indic shaper already had this check. We removed it when forking Khmer shaper by mistake. Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1464623
This commit is contained in:
parent
25970a93aa
commit
7b8dfac560
|
@ -372,22 +372,25 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note! syllable() is a one-byte field. */
|
if (unlikely (end - start >= 127))
|
||||||
for (unsigned int i = base; i < end; i++)
|
buffer->merge_clusters (start, end);
|
||||||
if (info[i].syllable() != 255)
|
else
|
||||||
{
|
/* Note! syllable() is a one-byte field. */
|
||||||
unsigned int max = i;
|
for (unsigned int i = base; i < end; i++)
|
||||||
unsigned int j = start + info[i].syllable();
|
if (info[i].syllable() != 255)
|
||||||
while (j != i)
|
|
||||||
{
|
{
|
||||||
max = MAX (max, j);
|
unsigned int max = i;
|
||||||
unsigned int next = start + info[j].syllable();
|
unsigned int j = start + info[i].syllable();
|
||||||
info[j].syllable() = 255; /* So we don't process j later again. */
|
while (j != i)
|
||||||
j = next;
|
{
|
||||||
|
max = MAX (max, j);
|
||||||
|
unsigned int next = start + info[j].syllable();
|
||||||
|
info[j].syllable() = 255; /* So we don't process j later again. */
|
||||||
|
j = next;
|
||||||
|
}
|
||||||
|
if (i != max)
|
||||||
|
buffer->merge_clusters (i, max + 1);
|
||||||
}
|
}
|
||||||
if (i != max)
|
|
||||||
buffer->merge_clusters (i, max + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Put syllable back in. */
|
/* Put syllable back in. */
|
||||||
for (unsigned int i = start; i < end; i++)
|
for (unsigned int i = start; i < end; i++)
|
||||||
|
|
Loading…
Reference in New Issue