diff --git a/src/core/jpg.js b/src/core/jpg.js index ac5397ac5..d34c72556 100644 --- a/src/core/jpg.js +++ b/src/core/jpg.js @@ -329,13 +329,12 @@ var JpegImage = (function JpegImageClosure() { } else { mcuExpected = mcusPerLine * frame.mcusPerColumn; } - if (!resetInterval) { - resetInterval = mcuExpected; - } var h, v; while (mcu < mcuExpected) { // reset interval stuff + var mcuToRead = resetInterval ? + Math.min(mcuExpected - mcu, resetInterval) : mcuExpected; for (i = 0; i < componentsLength; i++) { components[i].pred = 0; } @@ -343,12 +342,12 @@ var JpegImage = (function JpegImageClosure() { if (componentsLength === 1) { component = components[0]; - for (n = 0; n < resetInterval; n++) { + for (n = 0; n < mcuToRead; n++) { decodeBlock(component, decodeFn, mcu); mcu++; } } else { - for (n = 0; n < resetInterval; n++) { + for (n = 0; n < mcuToRead; n++) { for (i = 0; i < componentsLength; i++) { component = components[i]; h = component.h; diff --git a/test/pdfs/issue7828.pdf.link b/test/pdfs/issue7828.pdf.link new file mode 100644 index 000000000..7ec36fda5 --- /dev/null +++ b/test/pdfs/issue7828.pdf.link @@ -0,0 +1 @@ +https://github.com/mozilla/pdf.js/files/601312/Untitled_20160807_114311.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 95ba6363e..d6c462f0e 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -2099,6 +2099,13 @@ "type": "eq", "about": "Inline JPEG images." }, + { "id": "issue7828", + "file": "pdfs/issue7828.pdf", + "md5": "462f96c877f5761fc3176156e3526184", + "rounds": 1, + "link": true, + "type": "eq" + }, { "id": "issue1655", "file": "pdfs/issue1655r.pdf", "md5": "569f48449ba57c15c4f9ade151a651c5",