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

ROB: Fix infinite loop due to Invalid object #1331

Merged
merged 2 commits into from Sep 9, 2022

Conversation

pubpub-zz
Copy link
Collaborator

@pubpub-zz pubpub-zz commented Sep 7, 2022

fixes #1329

  • prevent loop within dictionnaries where objects not respecting standard
  • fix cmap warnings due to "numbered" characters ( #2d instead of -)
  • apply unnumbering to NameObject
  • add _get_indirect_object for debug/dev purpose
  • add some missing seeks (no issue reported yet)

fixes py-pdf#1329
*prevent loop within dictionnaries where objects not respecting standard
*fix cmap warnings due to "numbered" characters ( #2d instead of -)
*apply unnumbering to nameobject
*add _get_indirect_object for debug/dev purpose
*add some missing seeks (no issue reported yet)
@codecov
Copy link

codecov bot commented Sep 7, 2022

Codecov Report

Merging #1331 (d5e9547) into main (4073b2a) will decrease coverage by 0.13%.
The diff coverage is 83.78%.

@@            Coverage Diff             @@
##             main    #1331      +/-   ##
==========================================
- Coverage   94.85%   94.72%   -0.14%     
==========================================
  Files          30       30              
  Lines        5097     5118      +21     
  Branches     1049     1052       +3     
==========================================
+ Hits         4835     4848      +13     
- Misses        153      158       +5     
- Partials      109      112       +3     
Impacted Files Coverage Δ
PyPDF2/_reader.py 89.58% <50.00%> (-0.20%) ⬇️
PyPDF2/generic/_data_structures.py 96.01% <80.95%> (-0.96%) ⬇️
PyPDF2/_cmap.py 95.11% <100.00%> (+0.02%) ⬆️
PyPDF2/generic/_base.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pubpub-zz
Copy link
Collaborator Author

@MartinThoma
ready for review

return NameObject.read_from_stream(stream, pdf)
elif idx == 1:
elif tok == b"<":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that you got rid of ObjectPrefix / idx. It's way easier to read now 👍

@MartinThoma MartinThoma merged commit e6531a2 into py-pdf:main Sep 9, 2022
@MartinThoma
Copy link
Member

I'll start my big test suite + release today :-) Thank you for taking care of the issue 🙏

MartinThoma added a commit that referenced this pull request Sep 9, 2022
Robustness (ROB):
-  Fix infinite loop due to Invalid object (#1331)
-  Fix image extraction issue with superfluous whitespaces (#1327)

Full Changelog: 2.10.5...2.10.6
@pubpub-zz pubpub-zz deleted the iss1329 branch June 24, 2023 08:39
@MartinThoma
Copy link
Member

MartinThoma commented Jun 27, 2023

I think I should create a security advisory for this. It was fixed in PyPDF2==2.10.6

@MartinThoma MartinThoma added the nf-security Non-functional change: Security label Jun 29, 2023
@MartinThoma MartinThoma changed the title ROB : fix infinite loop due to Invalid object ROB: Fix infinite loop due to Invalid object Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nf-security Non-functional change: Security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite loop while reading metadata
2 participants