Merge pull request #8164 from Snuffleupagus/issue-7828

Don't read past the EOI marker for JPEG images with non-default restart interval (issue 7828)
This commit is contained in:
Jonas Jenwald 2017-03-20 22:17:28 +01:00 committed by GitHub
commit e2e13df4a5
3 changed files with 12 additions and 5 deletions

View File

@ -330,13 +330,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;
}
@ -344,12 +343,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;

View File

@ -0,0 +1 @@
https://github.com/mozilla/pdf.js/files/601312/Untitled_20160807_114311.pdf

View File

@ -2106,6 +2106,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",