[GSUB/GPOS] Reject Context/ChainContext lookups with zero input
This commit is contained in:
parent
2f87cebe10
commit
0981068b75
|
@ -857,6 +857,7 @@ struct ContextFormat3
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!c->check_struct (this)) return TRACE_RETURN (false);
|
if (!c->check_struct (this)) return TRACE_RETURN (false);
|
||||||
unsigned int count = glyphCount;
|
unsigned int count = glyphCount;
|
||||||
|
if (unlikely (!glyphCount)) return TRACE_RETURN (false);
|
||||||
if (!c->check_array (coverage, coverage[0].static_size, count)) return TRACE_RETURN (false);
|
if (!c->check_array (coverage, coverage[0].static_size, count)) return TRACE_RETURN (false);
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (!coverage[i].sanitize (c, this)) return TRACE_RETURN (false);
|
if (!coverage[i].sanitize (c, this)) return TRACE_RETURN (false);
|
||||||
|
@ -1386,6 +1387,7 @@ struct ChainContextFormat3
|
||||||
if (!backtrack.sanitize (c, this)) return TRACE_RETURN (false);
|
if (!backtrack.sanitize (c, this)) return TRACE_RETURN (false);
|
||||||
OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||||
if (!input.sanitize (c, this)) return TRACE_RETURN (false);
|
if (!input.sanitize (c, this)) return TRACE_RETURN (false);
|
||||||
|
if (unlikely (!input.len)) return TRACE_RETURN (false);
|
||||||
OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
|
OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
|
||||||
if (!lookahead.sanitize (c, this)) return TRACE_RETURN (false);
|
if (!lookahead.sanitize (c, this)) return TRACE_RETURN (false);
|
||||||
ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||||
|
|
Loading…
Reference in New Issue