Skip to content

Commit

Permalink
PDFBOX-1865: take the length of the stream into account when comparin…
Browse files Browse the repository at this point in the history
…g xobjects

git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1561782 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
lehmi committed Jan 27, 2014
1 parent f35efb2 commit 0ba8d7d
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,18 @@ public PDResources getResources()
Map<String, PDXObject> xobjects = retval.getXObjects();
if (xobjects != null && xobjects.containsKey(name))
{
retval.removeXObject(name);
LOG.debug("Removed XObjectForm "+name+" to avoid a recursion");
PDXObject xobject = xobjects.get(name);
if (xobject instanceof PDXObjectForm)
{
int length1 = getCOSStream().getInt(COSName.LENGTH);
int length2 = xobject.getCOSStream().getInt(COSName.LENGTH);
// seems to be the same object
if (length1 == length2)
{
retval.removeXObject(name);
LOG.debug("Removed XObjectForm "+name+" to avoid a recursion");
}
}
}
}
}
Expand Down

0 comments on commit 0ba8d7d

Please sign in to comment.