[glyf] Fix byterange check again

This commit is contained in:
Behdad Esfahbod committed 2022-06-27 20:26:57 -06:00
1 parent 20572f914c
commit 34c6c0193c
1 file changed
+2 -1
+2 -1
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