Merge pull request #2385 from yurydelendik/issue-2374

Rejects post table if maxp numGlyph does not match
This commit is contained in:
Brendan Dahl 2012-11-16 13:46:11 -08:00
commit 9910699fac
2 changed files with 22 additions and 2 deletions

View File

@ -3181,7 +3181,7 @@ var Font = (function FontClosure() {
}
}
function readPostScriptTable(post, properties) {
function readPostScriptTable(post, properties, maxpNumGlyphs) {
var start = (font.start ? font.start : 0) + post.offset;
font.pos = start;
@ -3198,6 +3198,10 @@ var Font = (function FontClosure() {
break;
case 0x00020000:
var numGlyphs = int16(font.getBytes(2));
if (numGlyphs != maxpNumGlyphs) {
valid = false;
break;
}
var glyphNameIndexes = [];
for (var i = 0; i < numGlyphs; ++i) {
var index = int16(font.getBytes(2));
@ -3532,7 +3536,7 @@ var Font = (function FontClosure() {
// The 'post' table has glyphs names.
if (post) {
var valid = readPostScriptTable(post, properties);
var valid = readPostScriptTable(post, properties, numGlyphs);
if (!valid) {
tables.splice(tables.indexOf(post), 1);
post = null;

File diff suppressed because one or more lines are too long