-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
pdf set to None followed by an attribute check on pdf #1107
Comments
jlshin
changed the title
pdf set to None following by an attribute check on pdf
pdf set to None followed by an attribute check on pdf
Jul 14, 2022
As a quick fix this makes sense. I'm not sure how to make a clean solution. Do you want to open a pr with your fix? |
jlshin
added a commit
to jlshin/PyPDF2
that referenced
this issue
Jul 14, 2022
MartinThoma
pushed a commit
that referenced
this issue
Jul 15, 2022
Guard pdf.strict with check if pdf is None in DictionaryObject.read_from_stream Closes #1107
mtd91429
pushed a commit
to mtd91429/PyPDF2
that referenced
this issue
Jul 15, 2022
Guard pdf.strict with check if pdf is None in DictionaryObject.read_from_stream Closes py-pdf#1107
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Python 3.8.13 with PyPDF2==2.5.0
Traceback
I cannot attach the PDF I am using, but I can explain what I think the bug is:
In
generic::_parse_content_stream
I hit the following condition, which sets thepdf
to None:https://github.com/py-pdf/PyPDF2/blob/1e4c2c9b4649449241b0ae166e7e90f6bc61596d/PyPDF2/generic.py#L1226
So by the time we get to:
https://github.com/py-pdf/PyPDF2/blob/1e4c2c9b4649449241b0ae166e7e90f6bc61596d/PyPDF2/generic.py#L808-L811
The above error is raised because
pdf
is None and has no attributestrict
I have gotten around it by modifying line 808 to
The text was updated successfully, but these errors were encountered: