]> git.parisson.com Git - pdf.js.git/commitdiff
Fixing invalid CFF DICT entry (#621)
authornotmasteryet <async.processingjs@yahoo.com>
Wed, 12 Oct 2011 01:27:47 +0000 (20:27 -0500)
committernotmasteryet <async.processingjs@yahoo.com>
Wed, 12 Oct 2011 01:27:47 +0000 (20:27 -0500)
fonts.js

index 2ab3a90b76eee461e938d5b55ffb41994d6fa752..4aa72eee05d012a5bf1418483733b4d85193f1f1 100644 (file)
--- a/fonts.js
+++ b/fonts.js
@@ -2859,7 +2859,15 @@ var Type2CFF = (function type2CFF() {
         if (b <= 21) {
           if (b === 12) {
             ++pos;
-            var b = (b << 8) | dict[pos];
+            var op = dict[pos];
+            if ((op > 14 && op < 17) ||
+                (op > 23 && op < 30) || op > 38) {
+              warn('Invalid CFF dictionary key: ' + op);
+              // trying to replace it with initialRandomSeed
+              // to pass sanitizer
+              dict[pos] = 19;
+            }
+            var b = (b << 8) | op;
           }
           entries.push([b, operands]);
           operands = [];