1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Ignore non-Stream /SMask-entries when parsing images (issue 14814)

This is similar to the pre-existing check used in the /Mask-case below, to handle *corrupt* PDF documents that include non-Stream /SMask-entries in images; please refer to the PDF specification:
https://web.archive.org/web/20220309040754if_/https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#page=216

*Please note:* Adobe Reader also fails to render the image on the second page, and displays an error message.
This commit is contained in:
Jonas Jenwald 2022-04-21 11:57:12 +02:00
parent 452a98b0e0
commit 39d1bdde09
4 changed files with 14 additions and 2 deletions

View file

@ -275,12 +275,16 @@ class PDFImage {
const mask = image.dict.get("Mask");
if (smask) {
smaskData = smask;
if (smask instanceof BaseStream) {
smaskData = smask;
} else {
warn("Unsupported /SMask format.");
}
} else if (mask) {
if (mask instanceof BaseStream || Array.isArray(mask)) {
maskData = mask;
} else {
warn("Unsupported mask format.");
warn("Unsupported /Mask format.");
}
}