Skip to content

Commit

Permalink
PDFBOX-5742: fix the collection of indirect object keys
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1914934 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
lehmi committed Dec 26, 2023
1 parent fb94c1b commit 57c5879
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,6 @@ public void getIndirectObjectKeys(List<COSObjectKey> indirectObjects)
}
if (cosBase instanceof COSObject)
{
indirectObjects.add(cosBaseKey);
// dereference object
cosBase = ((COSObject) cosBase).getObject();
}
Expand All @@ -794,6 +793,11 @@ else if (cosBase instanceof COSArray)
// descend to included array to collect all included indirect objects
((COSArray) cosBase).getIndirectObjectKeys(indirectObjects);
}
else if (cosBaseKey != null)
{
// add key for all indirect objects other than COSDictionary/COSArray
indirectObjects.add(cosBaseKey);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,6 @@ public void getIndirectObjectKeys(List<COSObjectKey> indirectObjects)
}
if (cosBase instanceof COSObject)
{
indirectObjects.add(cosBaseKey);
// dereference object
cosBase = ((COSObject) cosBase).getObject();
}
Expand All @@ -1475,6 +1474,11 @@ else if (cosBase instanceof COSArray)
// descend to included array to collect all included indirect objects
((COSArray) cosBase).getIndirectObjectKeys(indirectObjects);
}
else if (cosBaseKey != null)
{
// add key for all indirect objects other than COSDictionary/COSArray
indirectObjects.add(cosBaseKey);
}
}
}

Expand Down

0 comments on commit 57c5879

Please sign in to comment.