diff --git a/src/core/obj.js b/src/core/obj.js index 2037688d2..329880686 100644 --- a/src/core/obj.js +++ b/src/core/obj.js @@ -1051,12 +1051,13 @@ var XRef = (function XRefClosure() { trailers.push(position); position += skipUntil(buffer, position, startxrefBytes); } else if ((m = /^(\d+)\s+(\d+)\s+obj\b/.exec(token))) { - this.entries[m[1]] = { - offset: position, - gen: m[2] | 0, - uncompressed: true - }; - + if (typeof this.entries[m[1]] === 'undefined') { + this.entries[m[1]] = { + offset: position, + gen: m[2] | 0, + uncompressed: true + }; + } var contentLength = skipUntil(buffer, position, endobjBytes) + 7; var content = buffer.subarray(position, position + contentLength); diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index d65b22c82..a04973008 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -123,3 +123,4 @@ !issue5481.pdf !issue5567.pdf !issue5701.pdf +!issue5909.pdf diff --git a/test/pdfs/issue5909.pdf b/test/pdfs/issue5909.pdf new file mode 100755 index 000000000..425771802 Binary files /dev/null and b/test/pdfs/issue5909.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 5a511510f..e4ac3702a 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -2087,5 +2087,11 @@ "md5": "d5b37f8bf1b3aafa1b4fcf19ebdc7c74", "rounds": 1, "type": "eq" + }, + { "id": "issue5909", + "file": "pdfs/issue5909.pdf", + "md5": "51a724136c0c10008bd061a78ea4b8fc", + "rounds": 1, + "type": "load" } ]