[subset] Enforce cmap12 group ordering constraints in collect_mapping.
Fixes fuzzer issue: https://oss-fuzz.com/testcase-detail/6365271012540416
This commit is contained in:
parent
c99ad0f015
commit
8f9f0c494b
|
@ -738,11 +738,19 @@ struct CmapSubtableLongSegmented
|
||||||
hb_map_t *mapping, /* OUT */
|
hb_map_t *mapping, /* OUT */
|
||||||
unsigned num_glyphs) const
|
unsigned num_glyphs) const
|
||||||
{
|
{
|
||||||
|
hb_codepoint_t last_end = 0;
|
||||||
for (unsigned i = 0; i < this->groups.len; i++)
|
for (unsigned i = 0; i < this->groups.len; i++)
|
||||||
{
|
{
|
||||||
hb_codepoint_t start = this->groups[i].startCharCode;
|
hb_codepoint_t start = this->groups[i].startCharCode;
|
||||||
hb_codepoint_t end = hb_min ((hb_codepoint_t) this->groups[i].endCharCode,
|
hb_codepoint_t end = hb_min ((hb_codepoint_t) this->groups[i].endCharCode,
|
||||||
(hb_codepoint_t) HB_UNICODE_MAX);
|
(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;
|
hb_codepoint_t gid = this->groups[i].glyphID;
|
||||||
if (!gid)
|
if (!gid)
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue