[glyf] Fix byterange check again

This commit is contained in:
Behdad Esfahbod 2022-06-27 20:26:19 -06:00
parent 20572f914c
commit 34c6c0193c
1 changed files with 2 additions and 1 deletions

View File

@ -180,7 +180,8 @@ struct SimpleGlyph
const HBUINT16 *endPtsOfContours = &StructAfter<HBUINT16> (header);
int num_contours = header.numberOfContours;
assert (num_contours);
if (unlikely (!bytes.check_range (&endPtsOfContours[num_contours - 1]))) return false;
/* One extra item at the end, for the instruction-count below. */
if (unlikely (!bytes.check_range (&endPtsOfContours[num_contours]))) return false;
unsigned int num_points = endPtsOfContours[num_contours - 1] + 1;
points_.alloc (num_points + 4); // Allocate for phantom points, to avoid a possible copy