diff --git a/bower.json b/bower.json index 042871b04..46390c582 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.1.284", + "version": "1.1.286", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index 8f08832b0..1c0a9e942 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.284'; -PDFJS.build = '535b7c2'; +PDFJS.version = '1.1.286'; +PDFJS.build = 'dde3e4a'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -36870,6 +36870,16 @@ var Parser = (function ParserClosure() { this.buf2 = this.lexer.getObj(); } }, + tryShift: function Parser_tryShift() { + try { + this.shift(); + return true; + } catch (e) { + // Upon failure, the caller should reset this.lexer.pos to a known good + // state and call this.shift() twice to reset the buffers. + return false; + } + }, getObj: function Parser_getObj(cipherTransform) { var buf1 = this.buf1; this.shift(); @@ -37243,9 +37253,10 @@ var Parser = (function ParserClosure() { stream.pos = pos + length; lexer.nextChar(); - this.shift(); // '>>' - this.shift(); // 'stream' - if (!isCmd(this.buf1, 'endstream')) { + // Shift '>>' and check whether the new object marks the end of the stream + if (this.tryShift() && isCmd(this.buf2, 'endstream')) { + this.shift(); // 'stream' + } else { // bad stream length, scanning for endstream stream.pos = pos; var SCAN_BLOCK_SIZE = 2048; diff --git a/build/pdf.js b/build/pdf.js index 29500badd..e457ffb59 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.284'; -PDFJS.build = '535b7c2'; +PDFJS.version = '1.1.286'; +PDFJS.build = 'dde3e4a'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it diff --git a/build/pdf.worker.js b/build/pdf.worker.js index 2d704de5a..a504317fb 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.284'; -PDFJS.build = '535b7c2'; +PDFJS.version = '1.1.286'; +PDFJS.build = 'dde3e4a'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -30464,6 +30464,16 @@ var Parser = (function ParserClosure() { this.buf2 = this.lexer.getObj(); } }, + tryShift: function Parser_tryShift() { + try { + this.shift(); + return true; + } catch (e) { + // Upon failure, the caller should reset this.lexer.pos to a known good + // state and call this.shift() twice to reset the buffers. + return false; + } + }, getObj: function Parser_getObj(cipherTransform) { var buf1 = this.buf1; this.shift(); @@ -30837,9 +30847,10 @@ var Parser = (function ParserClosure() { stream.pos = pos + length; lexer.nextChar(); - this.shift(); // '>>' - this.shift(); // 'stream' - if (!isCmd(this.buf1, 'endstream')) { + // Shift '>>' and check whether the new object marks the end of the stream + if (this.tryShift() && isCmd(this.buf2, 'endstream')) { + this.shift(); // 'stream' + } else { // bad stream length, scanning for endstream stream.pos = pos; var SCAN_BLOCK_SIZE = 2048; diff --git a/package.json b/package.json index a5106daed..0c0603838 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.1.284", + "version": "1.1.286", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [ "Mozilla",