Update Zstd decompression for "unknown decompressed size" when streaming API was used for compression
@ajelenak đang làm issue này rồi.
Từ ngày 2/1/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Introduction
The Zstandard plugin for HDF5 should be modified to allow for an unknown decompressed size in the frame header.
Currently, the Zstd decompression scheme, following from the original implemention, uses ZSTD_getDecompressedSize to obtain the size of the decompressed buffer. The returned value is not validated and passed directly to malloc.
ZSTD_getDecompressedSize returns 0 if the decompressed size is empty, unknown, or an error has occured. If malloc is asked to allocate 0 bytes, it will return NULL, resulting in returning an error condition. This is an incorrect result if the decompressed size is actually empty or unknown and there is no actual error. ZSTD_getDecompressedSize is obsolete.
ZSTD_getFrameContentSize should replace the use of ZSTD_getDecompressedSize. ZSTD_getFrameContentSize distinguishes between empty, unknown, or an error. The unknown or error states are indicated by a return value of ZSTD_CONTENTSIZE_UNKNOWN or ZSTD_CONTENTSIZE_ERROR, respectively.
The unknown decompression state is common. This occurs when the compression is done via the streaming API via ZSTD_compressStream or ZSTD_compressStream2. ZSTD_compressStream2 in particular only stores the frame size when either ZSTD_e_end is provided on the initial call or ZSTD_CCtx_setPledgedSrcSize is used.
Tasks
- Use
ZSTD_getFrameContentSizeinstead of the obsoleteZSTD_getDecompressedSizeto correctly distinguish between empty, unknown, or error states when determining the decompressed size. - Recognize the unknown size state by checking the return value of
ZSTD_getFrameContentSizeagainstZSTD_CONTENTSIZE_UNKNOWN - Address unknown size state by growing buffer if needed or using stream decompression API via
ZSTD_decompressStream- The HDF5 library should know the expected number of bytes for a chunk. We should not be relying on the filter to figure this out.
References
- Ngôn ngữ chính
- CMake
- Star
- 21
- Fork
- 27
- Merge trung bình
- 8 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của HDFGroup/hdf5_plugins
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 50/100
HDFGroup/hdf5_plugins#291 · 1 bình luận ·
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 45/100
HDFGroup/hdf5_plugins#288 ·
-
Reading ZSTD compressed HDF5 files in HDFView and/or ParaView with HDF5 ZSTD plugin on Windows causes heap failure and crashCó thể đã có người làm @lrknox đã nhận 12 ngày trước. Đang mở
HDFGroup/hdf5_plugins#289 · 7 bình luận · 1 người được giao ·
-
Canonical name confirmation for H5Z_class3_t filter pluginsCó thể làm lại được @ajelenak đã nhận 128 ngày trước và không có pull request nào đang mở. Đang mở
HDFGroup/hdf5_plugins#255 · 27 bình luận · 3 reaction · 1 người được giao ·
-
blosc2 fails to link on OpenBSDCó thể làm lại được @ajelenak đã nhận 128 ngày trước và không có pull request nào đang mở. Đang mởComponent - Build Filter - BLOSC(2)
HDFGroup/hdf5_plugins#252 · 1 bình luận · 1 người được giao ·