Skip to content

Commit c5789f3

Browse files
committed
PDFBOX-6009: early deletion of MCR/OBJR dictionaries with no /Pg entry because source had the wrong /Pg entry
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1925813 13f79535-47bb-0310-9956-ffa450edef68
1 parent 61f721b commit c5789f3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ private COSBase createDictionaryClone(COSBase src, COSBase dstParent, COSDiction
422422
COSDictionary srcPageDict = srcDict.getCOSDictionary(COSName.PG);
423423
COSDictionary dstPageDict = null;
424424
COSBase kid = srcDict.getDictionaryObject(COSName.K);
425+
COSName type = srcDict.getCOSName(COSName.TYPE);
425426
if (srcPageDict != null)
426427
{
427428
dstPageDict = pageDictMap.get(srcPageDict);
@@ -435,8 +436,10 @@ private COSBase createDictionaryClone(COSBase src, COSBase dstParent, COSDiction
435436
}
436437
else
437438
{
438-
// PDFBOX-6009: quit if MCIDs because these need a /Pg entry
439-
if (hasMCIDs(kid))
439+
// PDFBOX-6009: "wrong" /Pg entry
440+
// quit if MCIDs because these need a /Pg entry
441+
// or if MCR/OBJR dicts
442+
if (COSName.MCR.equals(type) || COSName.OBJR.equals(type) || hasMCIDs(kid))
440443
{
441444
return null;
442445
}
@@ -445,7 +448,6 @@ private COSBase createDictionaryClone(COSBase src, COSBase dstParent, COSDiction
445448
}
446449

447450
// special handling for MCR items ("marked-content reference dictionary")
448-
COSName type = srcDict.getCOSName(COSName.TYPE);
449451
if (COSName.MCR.equals(type) && dstPageDict == null &&
450452
dstParent instanceof COSDictionary && ((COSDictionary) dstParent).getCOSDictionary(COSName.PG) == null)
451453
{

0 commit comments

Comments
 (0)