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

BUG: Make DictionaryObject.readFromStream check if any entry values refer to the null object #326

Closed
wants to merge 3 commits into from

Conversation

rwirth
Copy link

@rwirth rwirth commented Feb 13, 2017

Rewrite DictionaryObject.readFromStream to check if any entry values refer to the null object or to undefined objects. These entries are ignored and not committed into the object. A key with null value is treated as if it was absent from the dictionary (impacts #236) and does not cause a multiple definition error if it is set to a non-null value by another entry.

Fixes #325

… object

The only objects that can refer to the null object are the null object itself
and indirect references to nonexisten objects. In principle, there could be
an indirect reference to an existing object with value null. Catching this one
would require resolving the indirect reference, which is too much effort.
…g them

Entries with null values (either explicit or through references to nonexistent
objects) are completely ignored and do not cause multiple definition errors
if two entries are present for the same key and one has a null value.

Fixes issue py-pdf#325 and proposes a behavior for issue py-pdf#236.
@MartinThoma MartinThoma added the is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF label Apr 6, 2022
@MartinThoma
Copy link
Member

Hey! I know it's been 5 years since you opened the PR, but would to mind to fix the merge conflicts?

@MartinThoma MartinThoma added the needs-change The PR/issue cannot be handled as issue and needs to be improved label Apr 16, 2022
@MartinThoma MartinThoma changed the title Fix Issue #325 Make DictionaryObject.readFromStream check if any entry values refer to the null object Apr 16, 2022
@MartinThoma MartinThoma changed the title Make DictionaryObject.readFromStream check if any entry values refer to the null object BUG: Make DictionaryObject.readFromStream check if any entry values refer to the null object Jun 25, 2022
@MartinThoma MartinThoma added needs-rebase This PR cannot be merged as the main branch is too different. You need to rebase or merge main. Has MCVE A minimal, complete and verifiable example helps a lot to debug / understand feature requests and removed needs-change The PR/issue cannot be handled as issue and needs to be improved labels Jun 25, 2022
@MartinThoma
Copy link
Member

I think this was solved through other means. The added test works with the current main of PyPDF2.

Please open a new PR if you think something from this PR should get into main

@MartinThoma MartinThoma closed this Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Has MCVE A minimal, complete and verifiable example helps a lot to debug / understand feature requests is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF needs-rebase This PR cannot be merged as the main branch is too different. You need to rebase or merge main.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dictionary with undefined indirect object and direct object for same key fails
2 participants