[subset] Enforce cmap12 group ordering constraints in collect_mapping.

Fixes fuzzer issue: https://oss-fuzz.com/testcase-detail/6365271012540416
This commit is contained in:
Garret Rieger 2022-05-10 17:47:08 +00:00 committed by Behdad Esfahbod
parent c99ad0f015
commit 8f9f0c494b
2 changed files with 8 additions and 0 deletions

View File

@ -738,11 +738,19 @@ struct CmapSubtableLongSegmented
hb_map_t *mapping, /* OUT */
unsigned num_glyphs) const
{
hb_codepoint_t last_end = 0;
for (unsigned i = 0; i < this->groups.len; i++)
{
hb_codepoint_t start = this->groups[i].startCharCode;
hb_codepoint_t end = hb_min ((hb_codepoint_t) this->groups[i].endCharCode,
(hb_codepoint_t) HB_UNICODE_MAX);
if (unlikely (start > end || start < last_end)) {
// Range is not in order and is invalid, skip it.
continue;
}
last_end = end;
hb_codepoint_t gid = this->groups[i].glyphID;
if (!gid)
{