1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Attempt to skip zero bytes at the end of Scan blocks when decoding JPEG images (issue 4090)

This commit is contained in:
Jonas Jenwald 2016-09-22 10:11:27 +02:00
parent a9a3396f3d
commit 54ee83eb12
3 changed files with 15 additions and 0 deletions

View file

@ -365,6 +365,12 @@ var JpegImage = (function JpegImageClosure() {
// find marker
bitsCount = 0;
marker = (data[offset] << 8) | data[offset + 1];
// Some bad images seem to pad Scan blocks with zero bytes, skip past
// those to attempt to find a valid marker (fixes issue4090.pdf).
while (data[offset] === 0x00 && offset < data.length - 1) {
offset++;
marker = (data[offset] << 8) | data[offset + 1];
}
if (marker <= 0xFF00) {
error('JPEG error: marker was not found');
}