diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2022-07-08 19:10:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-08 19:10:29 (GMT) |
commit | a45ade88863e7e413ec408cdc62d60a1c1bc76a2 (patch) | |
tree | 188190e709294244ea0661759b04c8c4c76d76b6 | |
parent | fe413fc6ff6ee763fedb083fb0f4f0ad221a388c (diff) | |
download | hdf5-a45ade88863e7e413ec408cdc62d60a1c1bc76a2.zip hdf5-a45ade88863e7e413ec408cdc62d60a1c1bc76a2.tar.gz hdf5-a45ade88863e7e413ec408cdc62d60a1c1bc76a2.tar.bz2 |
Fix for memory allocation issue identified by fuzzer (#732) (#1860)
GitHub issue #732 claims that mallocing a particular buffer can
trigger undefined behavior and that callocing the buffer fixes
the issue.
I did not confirm this, but the fix is trivial and better anyway.
-rw-r--r-- | src/H5Gcompact.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index d98e047..cc6113d 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -138,7 +138,7 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_ind H5O_mesg_operator_t op; /* Message operator */ /* Allocate the link table */ - if ((ltable->lnks = (H5O_link_t *)H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL) + if ((ltable->lnks = (H5O_link_t *)H5MM_calloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Set up user data for iteration */ |