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

Fixed allocation-size-too-big error in H5MM.c #5076

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
13 changes: 7 additions & 6 deletions src/H5Centry.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,17 +943,18 @@ H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr, size_t *len
if (H5_addr_gt(addr, eoa))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "address of object past end of allocation");

/* Check if the amount of data to read will be past the EOA */
if (H5_addr_gt((addr + *len), eoa)) {
/* Check if the amount of data to read will be past the EOA, or wraps around */
if (H5_addr_lt((addr + *len), addr) || H5_addr_gt((addr + *len), eoa)) {
if (actual)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA");
else
else {
/* Trim down the length of the metadata */
*len = (size_t)(eoa - addr);
} /* end if */

if (*len <= 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA");
if (*len <= 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA");
} /* end else */
} /* end if */

done:
FUNC_LEAVE_NOAPI(ret_value)
Expand Down