Skip to content

Commit

Permalink
PDFBOX-5283: ignore dublicate object keys when correcting xRefs
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmidor committed Sep 23, 2021
1 parent 4896c6f commit 751e970
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1320,8 +1320,13 @@ private Map<COSObjectKey, Long> bfSearchForObjects() throws IOException
if (lastObjOffset > 0)
{
// add the former object ID only if there was a subsequent object ID
bfCOSObjectKeyOffsets.put(
new COSObjectKey(lastObjectId, lastGenID), lastObjOffset);
COSObjectKey objectKey = new COSObjectKey(lastObjectId, lastGenID);
if(!bfCOSObjectKeyOffsets.containsKey(objectKey)) {
bfCOSObjectKeyOffsets.put(objectKey, lastObjOffset);
} else {
LOG.debug("Ignoring duplicate object key (" + objectKey
+ ")");
}
}
lastObjectId = objectId;
lastGenID = genID;
Expand Down

0 comments on commit 751e970

Please sign in to comment.