Improve code coverage for zip module error paths#1555
Merged
d-e-s-o merged 1 commit intolibbpf:mainfrom Apr 24, 2026
Merged
Conversation
Code coverage of our zip module is comparably low, but solely so because of the various error conditions that we don't explicitly test. Add a bunch of tests that each corrupt specific bytes in the archive to trigger a different error path: invalid local file header magic, unsupported entry flags (encryption), invalid central directory header magic, truncated central directory records, multi-disk archive rejection, undersized archives, and out-of-bounds central directory ranges. In so doing we drastically improve coverage for this module. Signed-off-by: Daniel Müller <deso@posteo.net>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1555 +/- ##
==========================================
+ Coverage 95.50% 95.74% +0.23%
==========================================
Files 56 56
Lines 9551 9549 -2
==========================================
+ Hits 9122 9143 +21
+ Misses 429 406 -23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
99.32% coverage of |
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.
Code coverage of our zip module is comparably low, but solely so because of the various error conditions that we don't explicitly test.
Add a bunch of tests that each corrupt specific bytes in the archive to trigger a different error path: invalid local file header magic, unsupported entry flags (encryption), invalid central directory header magic, truncated central directory records, multi-disk archive rejection, undersized archives, and out-of-bounds central directory ranges. In so doing we drastically improve coverage for this module.