JuliaIO / HDF5.jl

Save and load data in the HDF5 file format from Julia
https://juliaio.github.io/HDF5.jl
MIT License
380 stars 138 forks source link

Fix H5Zzstd error reporting and decompressed size behavior #1151

Closed mkitti closed 1 month ago

mkitti commented 1 month ago

https://github.com/JuliaIO/JLD2.jl/pull/560 revealed that error reporting was not occuring when there were errors present.

  1. ZSTD_getDecompressedSize can result in an error, resulting in a return value of 0.
  2. Libc.malloc(0) may not return a null pointer.

Therefore we need to check the return value of ZSTD_getDecompressedSize directly before trying to malloc.

Also improve error handing overall.

mkitti commented 1 month ago

Also note that ZSTD_getDecompressedSize is deprecated.