Skip to content

Commit 360928d

Browse files
committedMay 14, 2021
8260046: Assert left >= right in pointer_delta() methods
Reviewed-by: sjohanss, kbarrett, tschatzl
1 parent 5eda812 commit 360928d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed
 

‎src/hotspot/share/utilities/globalDefinitions.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ inline address_word castable_address(void* x) { return address_w
416416
inline size_t pointer_delta(const volatile void* left,
417417
const volatile void* right,
418418
size_t element_size) {
419+
assert(left >= right, "avoid underflow");
419420
return (((uintptr_t) left) - ((uintptr_t) right)) / element_size;
420421
}
421422

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on May 14, 2021

@openjdk-notifier[bot]
Please sign in to comment.