Browse Source

Merge pull request #3183 from brendandahl/ignore-bad-dicts

Ignore malformed dictionary entries.
Yury Delendik 12 years ago
parent
commit
78ad4d4eaf
  1. 9
      src/parser.js
  2. 2
      test/pdfs/bug808084.pdf.link
  3. 8
      test/test_manifest.json

9
src/parser.js

@ -17,7 +17,7 @@
/* globals Ascii85Stream, AsciiHexStream, CCITTFaxStream, Cmd, Dict, error, /* globals Ascii85Stream, AsciiHexStream, CCITTFaxStream, Cmd, Dict, error,
FlateStream, isArray, isCmd, isDict, isInt, isName, isNum, isRef, FlateStream, isArray, isCmd, isDict, isInt, isName, isNum, isRef,
isString, Jbig2Stream, JpegStream, JpxStream, LZWStream, Name, isString, Jbig2Stream, JpegStream, JpxStream, LZWStream, Name,
NullStream, PredictorStream, Ref, RunLengthStream, warn */ NullStream, PredictorStream, Ref, RunLengthStream, warn, info */
'use strict'; 'use strict';
@ -85,8 +85,11 @@ var Parser = (function ParserClosure() {
this.shift(); this.shift();
var dict = new Dict(this.xref); var dict = new Dict(this.xref);
while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) { while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) {
if (!isName(this.buf1)) if (!isName(this.buf1)) {
error('Dictionary key must be a name object'); info('Malformed dictionary, key must be a name object');
this.shift();
continue;
}
var key = this.buf1.name; var key = this.buf1.name;
this.shift(); this.shift();

2
test/pdfs/bug808084.pdf.link

@ -0,0 +1,2 @@
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf

8
test/test_manifest.json

@ -1051,6 +1051,14 @@
"type": "eq", "type": "eq",
"about": "Has a 4 bit per component image with mask and decode." "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", { "id": "issue3064",
"file": "pdfs/issue3064.pdf", "file": "pdfs/issue3064.pdf",
"md5": "0307415b7d69b13acaf8bd4285d9544b", "md5": "0307415b7d69b13acaf8bd4285d9544b",

Loading…
Cancel
Save