Skip to content

Commit

Permalink
Fix range check in H5_addr_overlap (HDFGroup#4278)
Browse files Browse the repository at this point in the history
When the H5_addr_overlap macro was updated to use H5_RANGE_OVERLAP,
it failed to take into account that H5_RANGE_OVERLAP expects the
range to be inclusive. This lead to an assertion failure in
H5MM_memcpy due to a memcpy operation on overlapping memory.
This has been fixed by subtracting 1 from the calculated high
bound values passed to H5_RANGE_OVERLAP
  • Loading branch information
jhendersonHDF authored and lrknox committed Mar 29, 2024
1 parent 9e24749 commit 3fa26d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/H5private.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@
(X) >= (Y))
#define H5_addr_cmp(X,Y) (H5_addr_eq((X), (Y)) ? 0 : \
(H5_addr_lt((X), (Y)) ? -1 : 1))
#define H5_addr_overlap(O1,L1,O2,L2) H5_RANGE_OVERLAP(O1, ((O1)+(L1)), O2, ((O2)+(L2)))
#define H5_addr_overlap(O1,L1,O2,L2) H5_RANGE_OVERLAP(O1, ((O1)+(L1)-1), O2, ((O2)+(L2)-1))
/* clang-format on */

/*
Expand Down

0 comments on commit 3fa26d8

Please sign in to comment.