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:
commit
e2e13df4a5
@ -330,13 +330,12 @@ var JpegImage = (function JpegImageClosure() {
|
|||||||
} else {
|
} else {
|
||||||
mcuExpected = mcusPerLine * frame.mcusPerColumn;
|
mcuExpected = mcusPerLine * frame.mcusPerColumn;
|
||||||
}
|
}
|
||||||
if (!resetInterval) {
|
|
||||||
resetInterval = mcuExpected;
|
|
||||||
}
|
|
||||||
|
|
||||||
var h, v;
|
var h, v;
|
||||||
while (mcu < mcuExpected) {
|
while (mcu < mcuExpected) {
|
||||||
// reset interval stuff
|
// reset interval stuff
|
||||||
|
var mcuToRead = resetInterval ?
|
||||||
|
Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
|
||||||
for (i = 0; i < componentsLength; i++) {
|
for (i = 0; i < componentsLength; i++) {
|
||||||
components[i].pred = 0;
|
components[i].pred = 0;
|
||||||
}
|
}
|
||||||
@ -344,12 +343,12 @@ var JpegImage = (function JpegImageClosure() {
|
|||||||
|
|
||||||
if (componentsLength === 1) {
|
if (componentsLength === 1) {
|
||||||
component = components[0];
|
component = components[0];
|
||||||
for (n = 0; n < resetInterval; n++) {
|
for (n = 0; n < mcuToRead; n++) {
|
||||||
decodeBlock(component, decodeFn, mcu);
|
decodeBlock(component, decodeFn, mcu);
|
||||||
mcu++;
|
mcu++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (n = 0; n < resetInterval; n++) {
|
for (n = 0; n < mcuToRead; n++) {
|
||||||
for (i = 0; i < componentsLength; i++) {
|
for (i = 0; i < componentsLength; i++) {
|
||||||
component = components[i];
|
component = components[i];
|
||||||
h = component.h;
|
h = component.h;
|
||||||
|
1
test/pdfs/issue7828.pdf.link
Normal file
1
test/pdfs/issue7828.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://github.com/mozilla/pdf.js/files/601312/Untitled_20160807_114311.pdf
|
@ -2106,6 +2106,13 @@
|
|||||||
"type": "eq",
|
"type": "eq",
|
||||||
"about": "Inline JPEG images."
|
"about": "Inline JPEG images."
|
||||||
},
|
},
|
||||||
|
{ "id": "issue7828",
|
||||||
|
"file": "pdfs/issue7828.pdf",
|
||||||
|
"md5": "462f96c877f5761fc3176156e3526184",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": true,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue1655",
|
{ "id": "issue1655",
|
||||||
"file": "pdfs/issue1655r.pdf",
|
"file": "pdfs/issue1655r.pdf",
|
||||||
"md5": "569f48449ba57c15c4f9ade151a651c5",
|
"md5": "569f48449ba57c15c4f9ade151a651c5",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user