1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 01:28:06 +02:00

Tweak the heuristic that handles JPEG images with a wildly incorrect SOF (Start of Frame) scanLines parameter (issue 15492)

This commit is contained in:
Jonas Jenwald 2022-09-22 14:04:37 +02:00
parent 784ec3978a
commit f1b0dc6f04
3 changed files with 12 additions and 3 deletions

View file

@ -163,11 +163,11 @@ function decodeScan(
// Heuristic to attempt to handle corrupt JPEG images with too
// large `scanLines` parameter, by falling back to the currently
// parsed number of scanLines when it's at least (approximately)
// one order of magnitude smaller than expected (fixes
// issue10880.pdf and issue10989.pdf).
// one "half" order of magnitude smaller than expected (fixes
// issue10880.pdf, issue10989.pdf, issue15492.pdf).
if (
maybeScanLines > 0 &&
Math.round(frame.scanLines / maybeScanLines) >= 10
Math.round(frame.scanLines / maybeScanLines) >= 5
) {
throw new DNLMarkerError(
"Found EOI marker (0xFFD9) while parsing scan data, " +