Skip to content

Conversation

@veloman-yunkan
Copy link
Collaborator

PR #1029 was merged prematurely and broke the CI. This PR fixes the issues introduces by #1029, but also eliminates a pre-existing loophole for a crash scenario.

Fixed compilation failure in cluster and creator unit-tests that rely
on the non-public API of libzim.
Detection of corrupted offset of the first blob in a cluster was
implemented under the assumption that clusters cannot be empty.

The falsehood of that assumption is demonstrated by the existence
of the ClusterTest.read_write_no_content unit test.
@codecov
Copy link

codecov bot commented Jan 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.25%. Comparing base (d767195) to head (b385e36).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1031      +/-   ##
==========================================
+ Coverage   56.18%   56.25%   +0.07%     
==========================================
  Files         101      101              
  Lines        4989     5002      +13     
  Branches     2170     2177       +7     
==========================================
+ Hits         2803     2814      +11     
+ Misses        739      738       -1     
- Partials     1447     1450       +3     

☔ 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.

The test ZIM file
invalid.too_small_offset_of_first_blob_in_cluster_4.zim which simulated
a corrupted cluster header leading to a cluster with no blobs in it (a
case which was decriminalized by the previous commit) now caught a
situation where a crash could occur because of an out-of-bound access in
a cluster (this can happen due to invalid data in either a cluster
header or a dirent).

Cluster::getBlobOffset() must be checked at runtime too!
@veloman-yunkan veloman-yunkan merged commit 2712a8d into main Jan 10, 2026
27 checks passed
@veloman-yunkan veloman-yunkan deleted the follow-up_of_PR1029 branch January 10, 2026 18:10
@kelson42 kelson42 added this to the 9.5.0 milestone Jan 10, 2026
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.

3 participants