Ensure that the cmap position is within the bounds of the font file in |readCmapTable|

This commit is contained in:
Jonas Jenwald 2015-04-02 15:31:21 +02:00
parent d484ebd492
commit 70b839386a

View File

@ -3250,7 +3250,10 @@ var Font = (function FontClosure() {
}
}
if (!potentialTable) {
if (potentialTable) {
font.pos = start + potentialTable.offset;
}
if (!potentialTable || font.peekByte() === -1) {
warn('Could not find a preferred cmap table.');
return {
platformId: -1,
@ -3260,7 +3263,6 @@ var Font = (function FontClosure() {
};
}
font.pos = start + potentialTable.offset;
var format = font.getUint16();
var length = font.getUint16();
var language = font.getUint16();