Skip to content

Commit

Permalink
Fix Address Sanitizer error for realloc()
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoklee committed Aug 27, 2024
1 parent 04bf2df commit 256524a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/H5Centry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,12 @@ H5C__load_entry(H5F_t *f,
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA");

/* Expand buffer to new size */
if (NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE)))
size_t s = actual_len + (size_t)H5C_IMAGE_EXTRA_SPACE;
if (s > 0x10000000000) {
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "actual_len exceeds 0x10000000000");
}
new_image = H5MM_realloc(image, s);
if (NULL == new_image)
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()");
image = (uint8_t *)new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
Expand Down

0 comments on commit 256524a

Please sign in to comment.