Skip to content

Commit 9e335a6

Browse files
committed
Merge pull request #6628 from Snuffleupagus/issue-6621
Ignore the /Mask entry in images unless its /ImageMask entry is explicitly set to `true` (issue 6621)
2 parents 9455095 + 50a7042 commit 9e335a6

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/core/image.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,12 @@ var PDFImage = (function PDFImageClosure() {
140140
this.smask = new PDFImage(xref, res, smask, false);
141141
} else if (mask) {
142142
if (isStream(mask)) {
143-
this.mask = new PDFImage(xref, res, mask, false, null, null, true);
143+
var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
144+
if (!imageMask) {
145+
warn('Ignoring /Mask in image without /ImageMask.');
146+
} else {
147+
this.mask = new PDFImage(xref, res, mask, false, null, null, true);
148+
}
144149
} else {
145150
// Color key mask (just an array).
146151
this.mask = mask;

test/pdfs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
!issue3879r.pdf
3333
!close-path-bug.pdf
3434
!issue6019.pdf
35+
!issue6621.pdf
3536
!issue1293r.pdf
3637
!issue6541.pdf
3738
!issue2948.pdf

test/pdfs/issue6621.pdf

14.2 KB
Binary file not shown.

test/test_manifest.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,13 @@
732732
"rounds": 1,
733733
"type": "load"
734734
},
735+
{ "id": "issue6621",
736+
"file": "pdfs/issue6621.pdf",
737+
"md5": "8079ce514fb2cdded4251eade6380ba9",
738+
"link": false,
739+
"rounds": 1,
740+
"type": "eq"
741+
},
735742
{ "id": "scan-bad",
736743
"file": "pdfs/scan-bad.pdf",
737744
"md5": "4cf988f01ab83f61aca57f406dfd6584",

0 commit comments

Comments
 (0)