Skip to content

Conversation

@mkitti
Copy link
Contributor

@mkitti mkitti commented Aug 18, 2025

This pull request updates the decompress function in numcodecs/zstd.pyx to properly handle frame content sizes that exceed size_t on 32-bit systems. It:

  • Stores the result of ZSTD_getFrameContentSize in an unsigned long long.
  • Checks for ZSTD_CONTENTSIZE_ERROR, ZSTD_CONTENTSIZE_UNKNOWN, and ensures the value does not exceed SIZE_MAX before casting to size_t.
  • Only allocates the output buffer after passing all validations.

This prevents negative sizes from being passed to PyBytes_FromStringAndSize, resolving system errors on 32-bit platforms.

Fixes #781

Assistance provided by GitHub Copilot Chat, an AI tool by GitHub, August 2025.

@mkitti mkitti force-pushed the zstd-frame-content-size-ull branch from 5cc5260 to b0fe556 Compare August 18, 2025 16:47
@codecov
Copy link

codecov bot commented Aug 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f42a233) to head (6ab3b78).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #782   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           64        64           
  Lines         2804      2804           
=========================================
  Hits          2804      2804           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mkitti mkitti force-pushed the zstd-frame-content-size-ull branch from 6ab3b78 to 786d31f Compare August 19, 2025 01:00
@mkitti
Copy link
Contributor Author

mkitti commented Aug 19, 2025

@d-v-b d-v-b merged commit b84bb76 into zarr-developers:main Aug 19, 2025
57 checks passed
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.

ZStd test fail on 32bit atchitectures

3 participants