ROB: Skip truncated bfrange and bfchar lines in process_cm_line - #3829
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3829 +/- ##
=======================================
Coverage 97.73% 97.73%
=======================================
Files 55 55
Lines 10421 10423 +2
Branches 1932 1932
=======================================
+ Hits 10185 10187 +2
Misses 130 130
Partials 106 106 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
stefan6419846
left a comment
There was a problem hiding this comment.
Thanks for the PR.
Could you please remember to follow our contribution guidelines regarding PR titles?
Additionally, why can we drop binascii.Error in favor of ValueError and IndexError?
|
Sorted the title with the ROB: prefix, sorry for missing that. On the exception change: |
Truncated /ToUnicode lines crash text extraction
A beginbfrange line with fewer than three tokens makes parse_bfrange read past the split list, and a beginbfchar line with a non-hex source token raises out of parse_bfchar. The bfrange call only caught binascii.Error and the bfchar call caught nothing, so a crafted /ToUnicode CMap takes down extract_text on the page. Widened both to skip the broken line and warn, same as the existing handling. LimitReachedError is a PyPdfError not a ValueError so the mapping size cap still propagates.