mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
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
3 changed files with 12 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue