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:
parent
452a98b0e0
commit
39d1bdde09
@ -275,12 +275,16 @@ class PDFImage {
|
|||||||
const mask = image.dict.get("Mask");
|
const mask = image.dict.get("Mask");
|
||||||
|
|
||||||
if (smask) {
|
if (smask) {
|
||||||
smaskData = smask;
|
if (smask instanceof BaseStream) {
|
||||||
|
smaskData = smask;
|
||||||
|
} else {
|
||||||
|
warn("Unsupported /SMask format.");
|
||||||
|
}
|
||||||
} else if (mask) {
|
} else if (mask) {
|
||||||
if (mask instanceof BaseStream || Array.isArray(mask)) {
|
if (mask instanceof BaseStream || Array.isArray(mask)) {
|
||||||
maskData = mask;
|
maskData = mask;
|
||||||
} else {
|
} else {
|
||||||
warn("Unsupported mask format.");
|
warn("Unsupported /Mask format.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -505,6 +505,7 @@
|
|||||||
!poppler-85140-0.pdf
|
!poppler-85140-0.pdf
|
||||||
!poppler-395-0-fuzzed.pdf
|
!poppler-395-0-fuzzed.pdf
|
||||||
!GHOSTSCRIPT-698804-1-fuzzed.pdf
|
!GHOSTSCRIPT-698804-1-fuzzed.pdf
|
||||||
|
!issue14814.pdf
|
||||||
!poppler-91414-0-53.pdf
|
!poppler-91414-0-53.pdf
|
||||||
!poppler-91414-0-54.pdf
|
!poppler-91414-0-54.pdf
|
||||||
!poppler-742-0-fuzzed.pdf
|
!poppler-742-0-fuzzed.pdf
|
||||||
|
BIN
test/pdfs/issue14814.pdf
Normal file
BIN
test/pdfs/issue14814.pdf
Normal file
Binary file not shown.
@ -98,6 +98,13 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue14814",
|
||||||
|
"file": "pdfs/issue14814.pdf",
|
||||||
|
"md5": "a1c8b677335ff5ea0d07e35e7dffb6e8",
|
||||||
|
"rounds": 1,
|
||||||
|
"firstPage": 2,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue14269",
|
{ "id": "issue14269",
|
||||||
"file": "pdfs/issue14269.pdf",
|
"file": "pdfs/issue14269.pdf",
|
||||||
"md5": "f34abf77a418f54e13fbcd03b063432e",
|
"md5": "f34abf77a418f54e13fbcd03b063432e",
|
||||||
|
Loading…
Reference in New Issue
Block a user