mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8001071: Add simple range check into VM implemenation of Unsafe access methods
Add simple check in debug version of VM. Reviewed-by: twisti, johnc
This commit is contained in:
parent
2d3b78abcc
commit
247b39e010
1 changed files with 2 additions and 0 deletions
|
@ -124,6 +124,8 @@ inline void* index_oop_from_field_offset_long(oop p, jlong field_offset) {
|
|||
assert((void*)p->obj_field_addr<oop>((jint)byte_offset) == ptr_plus_disp,
|
||||
"raw [ptr+disp] must be consistent with oop::field_base");
|
||||
}
|
||||
jlong p_size = HeapWordSize * (jlong)(p->size());
|
||||
assert(byte_offset < p_size, err_msg("Unsafe access: offset " INT64_FORMAT " > object's size " INT64_FORMAT, byte_offset, p_size));
|
||||
}
|
||||
#endif
|
||||
if (sizeof(char*) == sizeof(jint)) // (this constant folds!)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue