Skip to content

Commit 92033df

Browse files
authored
malloc --> calloc in H5B cache entry (#5053)
oss-fuzz occasionally complains about intermittent undefined behavior when when Boolean variables in H5C_cache_entry_t (like is_protected) are set to values other than 0 or 1 when parsing fuzzed files. Using calloc() to iniitialize the H5B_t struct (like other metadata already does) should fix this.
1 parent 8f0cdce commit 92033df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/H5B.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p /*out
215215
/*
216216
* Allocate file and memory data structures.
217217
*/
218-
if (NULL == (bt = H5FL_MALLOC(H5B_t)))
218+
if (NULL == (bt = H5FL_CALLOC(H5B_t)))
219219
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node");
220220
memset(&bt->cache_info, 0, sizeof(H5AC_info_t));
221221
bt->level = 0;

0 commit comments

Comments
 (0)