-
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
_cmap.py: avoid IndexError in parse_to_unicode #1110
Conversation
The code within the if block assumes that lst has index 0 and index 1. So the predicate should depend on lst having at least two elements. This resolves the error I described at py-pdf#1091 (comment) (I'm not sure that it would resolve the other issue raised by @MartinThoma)
Codecov Report
@@ Coverage Diff @@
## main #1110 +/- ##
=======================================
Coverage 91.94% 91.94%
=======================================
Files 24 24
Lines 4642 4642
Branches 957 957
=======================================
Hits 4268 4268
Misses 229 229
Partials 145 145
Continue to review full report at Codecov.
|
fwiw, in the dump.pdf that i ran into this problem with, on the first page, we see a character resource that is described in this way:
So i think the problem in |
The fix proposed in this MR is definitely incomplete -- please see #1111 |
Thank you so much 🤗 I've just merged it and I will create a release on PyPI on Sunday (17.07.2022) |
The code within the if block assumes that `lst` has index 0 and index 1. Fixes py-pdf#1091 Related to py-pdf#1111
New Features (ENH): - Add color and font_format to PdfReader.outlines[i] (#1104) - Extract Text Enhancement (whitespaces) (#1084) Bug Fixes (BUG): - Use `build_destination` for named destination outlines (#1128) - Avoid a crash when a ToUnicode CMap has an empty dstString in beginbfchar (#1118) - Prevent deduplication of PageObject (#1105) - None-check in DictionaryObject.read_from_stream (#1113) - Avoid IndexError in _cmap.parse_to_unicode (#1110) Documentation (DOC): - Explanation for git submodule - Watermark and stamp (#1095) Maintenance (MAINT): - Text extraction improvements (#1126) - Destination.color returns ArrayObject instead of tuple as fallback (#1119) - Use add_bookmark_destination in add_bookmark (#1100) - Use add_bookmark_destination in add_bookmark_dict (#1099) Testing (TST): - Remove xfail from test_outline_title_issue_1121 - Add test for arab text (#1127) - Add xfail for decryption fail (#1125) - Add xfail test for IndexError when extracting text (#1124) - Add MCVE showing outline title issue (#1123) Code Style (STY): - Apply black and isort - Use IntFlag for permissions_flag / update_page_form_field_values (#1094) - Simplify code (#1101) Full Changelog: 2.5.0...2.6.0
The code within the if block assumes that lst has index 0 and index 1.
So the predicate should depend on lst having at least two elements.
This resolves the error I described at
#1091 (comment)
(I'm not sure that it would resolve the other issue raised by
@MartinThoma)