From cec200a6645dd9ab98641598c22f532495698eef Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Tue, 30 Apr 2013 15:29:25 -0700 Subject: [PATCH] Ignore malformed dictionary entries. --- src/parser.js | 9 ++++++--- test/pdfs/bug808084.pdf.link | 2 ++ test/test_manifest.json | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 test/pdfs/bug808084.pdf.link diff --git a/src/parser.js b/src/parser.js index af4f9b5c8..97b9b1b1e 100644 --- a/src/parser.js +++ b/src/parser.js @@ -17,7 +17,7 @@ /* globals Ascii85Stream, AsciiHexStream, CCITTFaxStream, Cmd, Dict, error, FlateStream, isArray, isCmd, isDict, isInt, isName, isNum, isRef, isString, Jbig2Stream, JpegStream, JpxStream, LZWStream, Name, - NullStream, PredictorStream, Ref, RunLengthStream, warn */ + NullStream, PredictorStream, Ref, RunLengthStream, warn, info */ 'use strict'; @@ -85,8 +85,11 @@ var Parser = (function ParserClosure() { this.shift(); var dict = new Dict(this.xref); while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) { - if (!isName(this.buf1)) - error('Dictionary key must be a name object'); + if (!isName(this.buf1)) { + info('Malformed dictionary, key must be a name object'); + this.shift(); + continue; + } var key = this.buf1.name; this.shift(); diff --git a/test/pdfs/bug808084.pdf.link b/test/pdfs/bug808084.pdf.link new file mode 100644 index 000000000..9bbbb2e2d --- /dev/null +++ b/test/pdfs/bug808084.pdf.link @@ -0,0 +1,2 @@ +http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf + diff --git a/test/test_manifest.json b/test/test_manifest.json index e559b32ef..9464cba5f 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1051,6 +1051,14 @@ "type": "eq", "about": "Has a 4 bit per component image with mask and decode." }, + { "id": "bug808084", + "file": "pdfs/bug808084.pdf", + "md5": "b1c400de699af29ea3f1983bb26870ab", + "link": true, + "rounds": 1, + "lastPage": 1, + "type": "load" + }, { "id": "issue3064", "file": "pdfs/issue3064.pdf", "md5": "0307415b7d69b13acaf8bd4285d9544b",