Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Address Sanitizer error for realloc() #4770

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading