ROB: Avoid divison by zero when decoding FlateDecode PNG prediction#3641
Merged
stefan6419846 merged 2 commits intopy-pdf:mainfrom Feb 16, 2026
Merged
ROB: Avoid divison by zero when decoding FlateDecode PNG prediction#3641stefan6419846 merged 2 commits intopy-pdf:mainfrom
stefan6419846 merged 2 commits intopy-pdf:mainfrom
Conversation
Previously, calculating `bpp` could raise a ZeroDivisionError due to invalid column values. The validation has been extended in accordance to the PDF specification which requires these values to always be positive. Some additionally refactoring has been included to simplify the existing code and drop the exception handling where possible when retrieving the parameters.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3641 +/- ##
==========================================
+ Coverage 97.34% 97.36% +0.01%
==========================================
Files 55 55
Lines 9882 9879 -3
Branches 1806 1807 +1
==========================================
- Hits 9620 9619 -1
+ Misses 153 151 -2
Partials 109 109 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
stefan6419846
added a commit
that referenced
this pull request
Feb 17, 2026
## What's new ### Security (SEC) - Detect cyclic references when accessing TreeObject.children (#3645) by @stefan6419846 - Limit size of `/ToUnicode` entries (#3646) by @stefan6419846 - Limit FlateDecode recovery attempts (#3644) by @stefan6419846 ### Bug Fixes (BUG) - Avoid own object replacement logic in `PageObject.replace_contents` (#3638) by @stefan6419846 - Fix UnboundLocalError when update_page_form_field_values with /Sig (#3634) by @John-Sharp ### Robustness (ROB) - Avoid divison by zero when decoding FlateDecode PNG prediction (#3641) by @stefan6419846 [Full Changelog](6.7.0...6.7.1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, calculating
bppcould raise a ZeroDivisionError due to invalid column values. The validation has been extended in accordance to the PDF specification which requires these values to always be positive.Some additionally refactoring has been included to simplify the existing code and drop the exception handling where possible when retrieving the parameters.