Skip to content

Commit

Permalink
Replaced previous fix with QAK's fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bmribler committed Dec 3, 2024
1 parent 565b6de commit d1ff4dc
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/H5Centry.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,23 +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 ((ULONG_MAX - *len) >= addr) {
if (H5_addr_gt((addr + *len), eoa)) {
if (actual)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA");
else
/* Trim down the length of the metadata */
*len = (size_t)(eoa - addr);
} /* end if */
}
else {
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL,
"total of addr and len exceeds max possible value (potential corrupted data)");
}
/* 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 {
/* Trim down the length of the metadata */
*len = (size_t)(eoa - addr);

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

0 comments on commit d1ff4dc

Please sign in to comment.