Skip to content

Validate buffer sizes and preserve output layout in checksum decoders - #891

Open
justavibedev wants to merge 2 commits into
zarr-developers:mainfrom
justavibedev:fix/checksum-buffer-size
Open

justavibedev wants to merge 2 commits into
zarr-developers:mainfrom
justavibedev:fix/checksum-buffer-size

Conversation

@justavibedev

@justavibedev justavibedev commented Nov 6, 2026 •

Copy link
Copy Markdown

Fixes #890 and #894.

The first commit fixes input validation for CRC32, CRC32C and Adler32. CRC32 could decode an eight-byte buffer but rejected a view of those same bytes as two uint32s. It now checks the byte count on the contiguous view it uses to extract the checksum.

The second fixes the output buffer in JenkinsLookup3. Decoding a one-byte payload into a four-byte output could write the same byte four times and report success. It now checks the destination size before writing. The tests also cover correctly sized bytearrays, C- and Fortran-ordered matrices, and a strided output.

The checksum and Jenkins test modules passed locally (251 passed, one skipped). I used the upstream Python sources and the 0.17.1 wheel’s compiled extensions. I also checked exact payload bytes across 56 combinations of dtype, shape and memory order. Both release-note links rendered in the local docs build, which finished with warnings.

The earlier hosted run hit a separate package import failure with zfpy 1.0.1.post0 during test collection. #893 addresses that failure. Codex assisted with implementation and testing.

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.79%. Comparing base (4afa628) to head (089989b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #891      +/-   ##
==========================================
+ Coverage   89.71%   89.79%   +0.07%     
==========================================
  Files          27       27              
  Lines         914      921       +7     
==========================================
+ Hits          820      827       +7     
  Misses         94       94              
Files with missing lines Coverage Δ
src/numcodecs/checksum32.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@justavibedev justavibedev changed the title Validate checksum input sizes in bytes Validate buffer sizes and preserve output layout in checksum decoders Nov 6, 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.

Checksum32 rejects valid encoded buffers when viewed as words or rows

1 participant