Rejects post table if maxp numGlyph does not match
This commit is contained in:
parent
d302746c6b
commit
0646d397eb
@ -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;
|
var start = (font.start ? font.start : 0) + post.offset;
|
||||||
font.pos = start;
|
font.pos = start;
|
||||||
|
|
||||||
@ -3198,6 +3198,10 @@ var Font = (function FontClosure() {
|
|||||||
break;
|
break;
|
||||||
case 0x00020000:
|
case 0x00020000:
|
||||||
var numGlyphs = int16(font.getBytes(2));
|
var numGlyphs = int16(font.getBytes(2));
|
||||||
|
if (numGlyphs != maxpNumGlyphs) {
|
||||||
|
valid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
var glyphNameIndexes = [];
|
var glyphNameIndexes = [];
|
||||||
for (var i = 0; i < numGlyphs; ++i) {
|
for (var i = 0; i < numGlyphs; ++i) {
|
||||||
var index = int16(font.getBytes(2));
|
var index = int16(font.getBytes(2));
|
||||||
@ -3532,7 +3536,7 @@ var Font = (function FontClosure() {
|
|||||||
|
|
||||||
// The 'post' table has glyphs names.
|
// The 'post' table has glyphs names.
|
||||||
if (post) {
|
if (post) {
|
||||||
var valid = readPostScriptTable(post, properties);
|
var valid = readPostScriptTable(post, properties, numGlyphs);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
tables.splice(tables.indexOf(post), 1);
|
tables.splice(tables.indexOf(post), 1);
|
||||||
post = null;
|
post = null;
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user