mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Attempt to skip zero bytes at the end of Scan blocks when decoding JPEG images (issue 4090)
This commit is contained in:
parent
a9a3396f3d
commit
54ee83eb12
3 changed files with 15 additions and 0 deletions
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue