Ignore previously parsed xref streams

This commit is contained in:
= 2011-09-21 10:04:21 -07:00
parent 6e859fb3e4
commit e318820a39
3 changed files with 12 additions and 4 deletions

9
pdf.js
View File

@ -3094,10 +3094,11 @@ var XRef = (function() {
// check for 'XRefStm' key // check for 'XRefStm' key
if (IsInt(obj = dict.get('XRefStm'))) { if (IsInt(obj = dict.get('XRefStm'))) {
var pos = obj; var pos = obj;
if (pos in this.xrefstms) // ignore previously loaded xref streams (possible infinite recursion)
error('Invalid XRef table'); if (!(pos in this.xrefstms)) {
this.xrefstms[pos] = 1; // avoid infinite recursion this.xrefstms[pos] = 1;
this.readXRef(pos); this.readXRef(pos);
}
} }
return dict; return dict;

1
test/pdfs/f1040.pdf.link Normal file
View File

@ -0,0 +1 @@
http://www.irs.gov/pub/irs-pdf/f1040.pdf

View File

@ -139,5 +139,11 @@
"link": true, "link": true,
"rounds": 1, "rounds": 1,
"type": "load" "type": "load"
},
{ "id": "f1040",
"file": "pdfs/f1040.pdf",
"link": true,
"rounds": 1,
"type": "load"
} }
] ]