Skip to content

Commit

Permalink
Fix uninitialized memory issues in packet table (HDFGroup#4271)
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins authored Mar 28, 2024
1 parent 82442ed commit 8787e7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hl/src/H5TB.c
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
goto out;

/* alloc fill value attribute buffer */
if (NULL == (tmp_fill_buf = (unsigned char *)malloc(total_size)))
if (NULL == (tmp_fill_buf = (unsigned char *)calloc(1, total_size)))
goto out;

/* get the fill value attributes */
Expand Down
2 changes: 2 additions & 0 deletions hl/test/test_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ test_table(hid_t fid, int do_write)
field_type[3] = H5T_NATIVE_DOUBLE;
field_type[4] = H5T_NATIVE_INT;

memset(wbufd, 0, NRECORDS * sizeof(particle_t));

/*-------------------------------------------------------------------------
*
* Functions tested:
Expand Down

0 comments on commit 8787e7f

Please sign in to comment.