Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix resolving compressed objects in additional cross-reference table #452

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

delta-emil
Copy link

@delta-emil delta-emil commented Aug 28, 2024

It looks like there is a problem with resolving compressed objects (Type==2) in additional cross-reference table (referenced by /Prev in the main one), when the main one also references it in its own stream as a Type==1 object.

The problem seems to be that the additional cross-reference table is getting added to the xrefTable with no Vaule, just position, during the precessing of the main cross-reference table object when it's a Type==1 reference.

Then when the code uses the /Prev to also processes the additional cross-reference table, it tries to add it using xrefTable.Add(iref), but that does nothing because its objectID is already in the xrefTable (with the position, and null Value).

This then hinders the mechanisms in PdfReader:

  1. PdfReader needs to find a PdfCrossReferenceStream in iref.Value in order to resolve compressed objects. This causes the objects to be missing later.
  2. PdfReader, would also in the end, seeing null in iref.Value, parse the additional cross-reference object anew redundantly.

Unfortunately, I could not create a test case that I can share, because the file that revealed the bug contains data I am not allowed to share; and I'm not proficient enough with the pdf format to craft a sample pdf file from scratch.

PS: I saw that people reported an exception that look exactly as the one I was getting as issue #432, and it might be causing other hard-to-find problems if because of the missing objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant