Skip to content

Commit

Permalink
Fix H5Zzstd error reporting and decompressed size behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
mkitti committed May 26, 2024
1 parent eaf6641 commit 51a13ea
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions filters/H5Zzstd/src/H5Zzstd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ function H5Z_filter_zstd(
#decompresssion

decompSize = LibZstd.ZSTD_getDecompressedSize(inbuf, origSize)
if decompSize == 0
error(
"zstd_h5plugin: Cannot retrieve decompressed chunk size"
)
end
outbuf = Libc.malloc(decompSize)
if outbuf == C_NULL
error(
Expand Down Expand Up @@ -83,11 +88,11 @@ function H5Z_filter_zstd(
catch e
# "In the case of failure, the return value is 0 (zero) and all pointer arguments are left unchanged."
ret_value = Csize_t(0)
@error "H5Zzstd Non-Fatal ERROR: " err
display(stacktrace(catch_backtrace()))
@error "H5Zzstd Non-Fatal ERROR: " exception=(e, catch_backtrace())
#display(stacktrace(catch_backtrace()))
finally
if outbuf != C_NULL
free(outbuf)
Libc.free(outbuf)
end
end # try catch finally
return Csize_t(ret_value)
Expand Down

0 comments on commit 51a13ea

Please sign in to comment.