From 8527d27eae067db80cbd560857a54d47308e102e Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 22 Mar 2017 14:02:34 +0100 Subject: [PATCH] Ensure that `PDFDocument.documentInfo` doesn't fail during document load, when the entire XRef table hasn't been fetched yet (issue 8180) Similar to other `try-catch` statements in `/core` code, we must re-throw `MissingDataException` to prevent issues with missing data during document loading. Note that I'm not sure if/how we can test this, which is why the patch doesn't include any test(s). Fixes 8180. --- src/core/document.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/document.js b/src/core/document.js index 93b47543f..69524e480 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -595,6 +595,9 @@ var PDFDocument = (function PDFDocumentClosure() { try { infoDict = this.xref.trailer.get('Info'); } catch (err) { + if (err instanceof MissingDataException) { + throw err; + } info('The document information dictionary is invalid.'); } if (infoDict) {