[Coverage] Ensure increasing coverage in iteration

This commit is contained in:
Behdad Esfahbod 2018-12-26 22:08:54 -05:00
parent 50cd26d394
commit 8303a9b011
1 changed files with 3 additions and 3 deletions

View File

@ -994,15 +994,15 @@ struct CoverageFormat2
i++; i++;
if (more ()) if (more ())
{ {
hb_codepoint_t old = j; unsigned int old = coverage;
j = c->rangeRecord[i].start; j = c->rangeRecord[i].start;
if (unlikely (j <= old)) coverage = c->rangeRecord[i].value;
if (unlikely (coverage <= old))
{ {
/* Broken table. Skip. Important to avoid DoS. */ /* Broken table. Skip. Important to avoid DoS. */
i = c->rangeRecord.len; i = c->rangeRecord.len;
return; return;
} }
coverage = c->rangeRecord[i].value;
} }
return; return;
} }