[Pkg-javascript-commits] [pdf.js] 03/106: Ensure that entries in the Differences array of Type1 fonts are either numbers or names

David Prévot taffit at moszumanska.debian.org
Sat Jun 20 21:33:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 4c2ad3bc7b5ca872ea256d43d3224ff00c94c0e8
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Mon Mar 9 14:36:45 2015 +0100

    Ensure that entries in the Differences array of Type1 fonts are either numbers or names
    
    This patch is yet another installment in the (never ending) series of bugs in PDF files with non-embedded fonts.
    
    Fixes http://www.int.washington.edu/talks/WorkShops/int_08_37W/People/Franz_M/Franz.pdf.
---
 src/core/evaluator.js   |  7 ++++-
 test/pdfs/.gitignore    |  1 +
 test/pdfs/franz.pdf     | 81 +++++++++++++++++++++++++++++++++++++++++++++++++
 test/test_manifest.json |  8 +++++
 4 files changed, 96 insertions(+), 1 deletion(-)

diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index 418ef0d..a286f2f 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -1284,8 +1284,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
               var data = diffEncoding[j];
               if (isNum(data)) {
                 index = data;
-              } else {
+              } else if (isName(data)) {
                 differences[index++] = data.name;
+              } else if (isRef(data)) {
+                diffEncoding[j--] = xref.fetch(data);
+                continue;
+              } else {
+                error('Invalid entry in \'Differences\' array: ' + data);
               }
             }
           }
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index d65b22c..509a38e 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -2,6 +2,7 @@
 *.error
 
 !tracemonkey.pdf
+!franz.pdf
 !issue2391-1.pdf
 !issue2391-2.pdf
 !filled-background.pdf
diff --git a/test/pdfs/franz.pdf b/test/pdfs/franz.pdf
new file mode 100644
index 0000000..1475a79
--- /dev/null
+++ b/test/pdfs/franz.pdf
@@ -0,0 +1,81 @@
+%PDF-1.7
+%����
+1 0 obj 128
+endobj 
+2 0 obj 157
+endobj 
+3 0 obj 
+<<
+/Type /Encoding
+/Differences [0 /.notdef 1 /dotaccent /fi /fl /fraction /hungarumlaut /Lslash /lslash /ogonek /ring 10 /.notdef 11 /breve /minus 13 /.notdef 14 /Zcaron /zcaron /caron /dotlessi /dotlessj /ff /ffi /ffl 22 /.notdef 30 /grave /quotesingle /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question  [...]
+>>
+endobj 
+4 0 obj 
+<<
+/Pages 5 0 R
+/Type /Catalog
+>>
+endobj 
+5 0 obj 
+<<
+/MediaBox [0 0 200 50]
+/Kids [6 0 R]
+/Count 1
+/Type /Pages
+>>
+endobj 
+6 0 obj 
+<<
+/Parent 5 0 R
+/MediaBox [0 0 200 50]
+/Resources 
+<<
+/Font 
+<<
+/F1 7 0 R
+>>
+>>
+/Contents 8 0 R
+/Type /Page
+>>
+endobj 
+7 0 obj 
+<<
+/BaseFont /Helvetica-Bold
+/Subtype /Type1
+/Type /Font
+/Encoding 3 0 R
+>>
+endobj 
+8 0 obj 
+<<
+/Length 42
+>>
+stream
+BT
+10 20 TD
+/F1 20 Tf
+(Hello World) Tj
+ET
+
+endstream 
+endobj xref
+0 9
+0000000000 65535 f 
+0000000015 00000 n 
+0000000035 00000 n 
+0000000055 00000 n 
+0000002111 00000 n 
+0000002162 00000 n 
+0000002244 00000 n 
+0000002373 00000 n 
+0000002466 00000 n 
+trailer
+
+<<
+/Root 4 0 R
+/Size 9
+>>
+startxref
+2560
+%%EOF
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 5a51151..ecab6f7 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -490,6 +490,14 @@
        "lastPage": 1,
        "type": "eq"
     },
+    {  "id": "franz",
+       "file": "pdfs/franz.pdf",
+       "md5": "12f0bbdec09900cbdd86e1737ed5f992",
+       "link": false,
+       "rounds": 1,
+       "type": "eq",
+       "about": "Type1 font with |Ref|s in the Differences array of the Encoding dictionary."
+    },
     {  "id": "issue4934",
        "file": "pdfs/issue4934.pdf",
        "md5": "6099da44f677702ae65a648b51a2226d",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list