From e84813e7cc84c26a921ab9b188d5a7c287c4d65e Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 19 Jun 2018 10:16:23 +0200 Subject: [PATCH] Prevent hard errors if fetching the `Encrypt` dictionary fails in `XRef.parse` --- src/core/obj.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/obj.js b/src/core/obj.js index 641190f7d..620efbf4e 100644 --- a/src/core/obj.js +++ b/src/core/obj.js @@ -855,7 +855,16 @@ var XRef = (function XRefClosure() { } trailerDict.assignXref(this); this.trailer = trailerDict; - var encrypt = trailerDict.get('Encrypt'); + + let encrypt; + try { + encrypt = trailerDict.get('Encrypt'); + } catch (ex) { + if (ex instanceof MissingDataException) { + throw ex; + } + warn(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`); + } if (isDict(encrypt)) { var ids = trailerDict.get('ID'); var fileId = (ids && ids.length) ? ids[0] : '';