Skip to content

Commit 6d45cd3

Browse files
committed
Do not retrieve the number of contours for empty glyphs
Before this change php-font-lib always read the number of contours for a glyph. If a glyph has no data the read information would be incorrect. This could lead to invalid parsing of the glyph since the data may not represent the actual glyph format (simple). In fact, the data could be from outside the glyf table entirely. If the glyph was positioned as the last byte in the font a read error would be thrown.
1 parent efc928c commit 6d45cd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/FontLib/Glyph/Outline.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Outline extends BinaryStream {
4848
static function init(glyf $table, $offset, $size, BinaryStream $font) {
4949
$font->seek($offset);
5050

51-
if ($font->readInt16() > -1) {
51+
if ($size === 0 || $font->readInt16() > -1) {
5252
/** @var OutlineSimple $glyph */
5353
$glyph = new OutlineSimple($table, $offset, $size);
5454
}

0 commit comments

Comments
 (0)