Skip to content

Commit

Permalink
Allowing post area names to be >32767.
Browse files Browse the repository at this point in the history
Some fonts that cover all of unicode require post name entries greater than 
32767. While the standard strictly requires this limit. Common implementations 
support it (it was an artifact of 16-bit windows). 
Permitting this variance from the specification. 

Patch from bradnelson@.

BUG=None 
TEST=test/test_{un,}malicious_fonts.sh, unifont.ttf passes validation
Review URL:https://codereview.chromium.org/68173026/
  • Loading branch information
[email protected] committed Nov 19, 2013
1 parent 4c9fa65 commit b37eb50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/post.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ bool ots_post_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
if (!table.ReadU16(&post->glyph_name_index[i])) {
return OTS_FAILURE();
}
if (post->glyph_name_index[i] >= 32768) {
// Note: droid_arialuni.ttf fails this test.
return OTS_FAILURE(); // reserved area.
}
// Note: A strict interpretation of the specification requires name indexes
// are less than 32768. This, however, excludes fonts like unifont.ttf
// which cover all of unicode.
}

// Now we have an array of Pascal strings. We have to check that they are all
Expand Down
4 changes: 0 additions & 4 deletions test/BLACKLIST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ DroidSansFallback.ttf
# Malformed GLYF table; The content of flags array and the lengths of xCoordinates, yCoordinates are inconsistent.
DecoTypeNaskh.ttf

# Malformed POST table; A glyph index in the reserved area (>= 32768) is specified.
wqy-zenhei.ttf
unifont.ttf

# Malformed HMTX table; The table is too short.
mona.ttf

Expand Down

0 comments on commit b37eb50

Please sign in to comment.