Update Zstd decompression for "unknown decompressed size" when streaming API was used for compression
@ajelenak ci sta già lavorando.
Dal 2/1/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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
- Lingua principale
- CMake
- Stelle
- 21
- Fork
- 27
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di HDFGroup/hdf5_plugins
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 50/100
HDFGroup/hdf5_plugins#291 ·
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 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 crashForse già presa @lrknox l’ha presa 3 giorni fa. Aperta
HDFGroup/hdf5_plugins#289 · 7 commenti · 1 assegnatario ·
-
Canonical name confirmation for H5Z_class3_t filter pluginsForse di nuovo libera @ajelenak l’ha presa 119 giorni fa e non c’è nessuna pull request aperta. Aperta
HDFGroup/hdf5_plugins#255 · 27 commenti · 3 reazioni · 1 assegnatario ·
-
blosc2 fails to link on OpenBSDForse di nuovo libera @ajelenak l’ha presa 119 giorni fa e non c’è nessuna pull request aperta. ApertaComponent - Build Filter - BLOSC(2)
HDFGroup/hdf5_plugins#252 · 1 commento · 1 assegnatario ·