diff --git a/src/core/xref.js b/src/core/xref.js index 6f1190bd7c294..ace4196578246 100644 --- a/src/core/xref.js +++ b/src/core/xref.js @@ -665,8 +665,8 @@ class XRef { // circular dependency between tables (fixes bug1393476.pdf). const startXRefParsedCache = new Set(); - try { - while (this.startXRefQueue.length) { + while (this.startXRefQueue.length) { + try { const startXRef = this.startXRefQueue[0]; if (startXRefParsedCache.has(startXRef)) { @@ -734,20 +734,18 @@ class XRef { // This is a fallback for non-compliant PDFs, i.e. "/Prev NNN 0 R" this.startXRefQueue.push(obj.num); } - - this.startXRefQueue.shift(); - } - - return this.topDict; - } catch (e) { - if (e instanceof MissingDataException) { - throw e; + } catch (e) { + if (e instanceof MissingDataException) { + throw e; + } + info("(while reading XRef): " + e); } - info("(while reading XRef): " + e); - this.startXRefQueue.shift(); } + if (this.topDict) { + return this.topDict; + } if (recoveryMode) { return undefined; } diff --git a/test/pdfs/issue15833.pdf.link b/test/pdfs/issue15833.pdf.link new file mode 100644 index 0000000000000..71adf734b587f --- /dev/null +++ b/test/pdfs/issue15833.pdf.link @@ -0,0 +1 @@ +https://github.com/mozilla/pdf.js/files/10236962/issue15833.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index a2f856e5b2e08..b4b28fd87060e 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -3522,6 +3522,14 @@ "37R": false } }, + { "id": "issue15833", + "file": "pdfs/issue15833.pdf", + "md5": "9562d027b980ea2779dcfb1669f9cf7e", + "link": true, + "rounds": 1, + "lastPage": 1, + "type": "eq" + }, { "id": "issue11242", "file": "pdfs/issue11242_reduced.pdf", "md5": "ba50b6ee537f3e815ccfe0c99e598e05",