[fvar] Rewrite sanitize

This commit is contained in:
Behdad Esfahbod 2018-11-19 13:09:53 -05:00
parent 4a6a692e3e
commit 56c9238d3d
1 changed files with 3 additions and 5 deletions

View File

@ -101,12 +101,10 @@ struct fvar
return_trace (version.sanitize (c) && return_trace (version.sanitize (c) &&
likely (version.major == 1) && likely (version.major == 1) &&
c->check_struct (this) && c->check_struct (this) &&
axisSize == 20 && /* Assumed in our code. */
instanceSize >= axisCount * 4 + 4 && instanceSize >= axisCount * 4 + 4 &&
axisSize <= 1024 && /* Arbitrary, just to simplify overflow checks. */ get_axes ().sanitize (c) &&
instanceSize <= 1024 && /* Arbitrary, just to simplify overflow checks. */ c->check_range (get_first_instance (), instanceCount, instanceSize));
c->check_range (this, firstAxis) &&
c->check_range (&StructAtOffset<char> (this, firstAxis),
axisCount * axisSize + instanceCount * instanceSize));
} }
inline unsigned int get_axis_count (void) const inline unsigned int get_axis_count (void) const