Skip to content

ROB: Silently ignore Adobe Ascii85 whitespace#3528

Merged
stefan6419846 merged 6 commits intopy-pdf:mainfrom
mbierma:main
Nov 21, 2025
Merged

ROB: Silently ignore Adobe Ascii85 whitespace#3528
stefan6419846 merged 6 commits intopy-pdf:mainfrom
mbierma:main

Conversation

@mbierma
Copy link
Copy Markdown
Contributor

@mbierma mbierma commented Nov 20, 2025

The PDF standard specifies that "the ASCII85Decode filter shall ignore all white-space characters" (spaces, tabs, newlines, etc.)

  • While the code currently strips leading and trailing whitespace, it fails to remove whitespace characters contained within the main data stream

  • This issue manifests because the Python standard library a85decode is performing its end-of-data check (~>) before honoring the ignorechars parameter for internal whitespace

This can cause failures when decoding certain PDF files and the fix improves the robustness of #2996.

The update ensures that all whitespace characters immediately preceding the final > are removed prior to passing the data to the a85decode decoder.

mbierma added 2 commits November 20, 2025 00:19
Based on the PDF standards "the ASCII85Decode filter shall ignore
all white-space characters".
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.16%. Comparing base (e9e3735) to head (dec66f5).
⚠️ Report is 86 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3528   +/-   ##
=======================================
  Coverage   97.16%   97.16%           
=======================================
  Files          57       57           
  Lines        9807     9809    +2     
  Branches     1780     1781    +1     
=======================================
+ Hits         9529     9531    +2     
  Misses        167      167           
  Partials      111      111           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@stefan6419846 stefan6419846 left a comment

Choose a reason for hiding this comment

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

Thanks.

@stefan6419846
Copy link
Copy Markdown
Collaborator

Please note that it might take another day to merge this as https://docs.python.org is currently offline and we rely on it for generating documentation, which would fail our CI on the merge commit otherwise.

@stefan6419846 stefan6419846 merged commit 82faf98 into py-pdf:main Nov 21, 2025
16 checks passed
stefan6419846 added a commit that referenced this pull request Nov 23, 2025
## What's new

### Security (SEC)
- Reduce default limit for LZW decoding by @stefan6419846

### New Features (ENH)
- Parse and format comb fields in text widget annotations (#3519) by @PJBrs

### Robustness (ROB)
- Silently ignore Adobe Ascii85 whitespace for suffix detection (#3528) by @mbierma

[Full Changelog](6.3.0...6.4.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants