diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 4131a92854e..d9520d1b3ff 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -931,7 +931,10 @@ H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_ /* Determine correct bin which holds items of the section's size */ bin = H5VM_log2_gen(sect->size); - assert(bin < sinfo->nbins); + /* Check if the bin index is within bounds */ + if (bin >= sinfo->nbins) + HGOTO_ERROR(H5E_FSPACE, H5E_BADVALUE, FAIL, "bin index out of bounds"); + if (sinfo->bins[bin].bin_list == NULL) { if (NULL == (sinfo->bins[bin].bin_list = H5SL_create(H5SL_TYPE_HSIZE, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for free space nodes"); diff --git a/src/H5SM.c b/src/H5SM.c index 2b98bdbb98b..b3dd8ab04c3 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -1538,6 +1538,11 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) assert(H5_addr_defined(H5F_SOHM_ADDR(f))); assert(sh_mesg); + /* Validate the SOHM address */ + if (!H5_addr_defined(H5F_SOHM_ADDR(f))) { + HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "SOHM address is invalid or uninitialized"); + } + /* Get message type */ type_id = sh_mesg->msg_type_id;