1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Fixes cvt table length; removes cvt when hints invalid

This commit is contained in:
Yury Delendik 2013-11-08 11:38:36 -06:00
parent d4167b62c8
commit 57e2a667ee
3 changed files with 17 additions and 2 deletions

View file

@ -3647,7 +3647,7 @@ var Font = (function FontClosure() {
}
}
function sanitizeTTPrograms(fpgm, prep) {
function sanitizeTTPrograms(fpgm, prep, cvt) {
var ttContext = {
functionsDefined: [],
functionsUsed: [],
@ -3664,6 +3664,11 @@ var Font = (function FontClosure() {
if (fpgm) {
checkInvalidFunctions(ttContext, maxFunctionDefs);
}
if (cvt && (cvt.length & 1)) {
var cvtData = new Uint8Array(cvt.length + 1);
cvtData.set(cvt.data);
cvt.data = cvtData;
}
return ttContext.hintsValid;
}
@ -3735,10 +3740,11 @@ var Font = (function FontClosure() {
}
var hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep,
maxFunctionDefs);
tables['cvt '], maxFunctionDefs);
if (!hintsValid) {
delete tables.fpgm;
delete tables.prep;
delete tables['cvt '];
}
// Tables needs to be written by ascendant alphabetic order