summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-07-08 19:10:29 (GMT)
committerGitHub <noreply@github.com>2022-07-08 19:10:29 (GMT)
commita45ade88863e7e413ec408cdc62d60a1c1bc76a2 (patch)
tree188190e709294244ea0661759b04c8c4c76d76b6 /src
parentfe413fc6ff6ee763fedb083fb0f4f0ad221a388c (diff)
downloadhdf5-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.
Diffstat (limited to 'src')
-rw-r--r--src/H5Gcompact.c2
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 */