Skip to content

Commit a96de6d

Browse files
committedJul 15, 2024
8336256: memcpy short value to int local is incorrect in VtableStubs::unsafe_hash
Reviewed-by: stuefe, shade, kvn
1 parent 3f2636d commit a96de6d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/hotspot/share/code/vtableStubs.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ inline uint VtableStubs::unsafe_hash(address entry_point) {
262262
address vtable_type_addr = vtable_stub_addr + offset_of(VtableStub, _type);
263263
address vtable_index_addr = vtable_stub_addr + offset_of(VtableStub, _index);
264264
bool is_vtable_stub = *vtable_type_addr == static_cast<uint8_t>(VtableStub::Type::vtable_stub);
265-
int vtable_index;
265+
short vtable_index;
266+
static_assert(sizeof(VtableStub::_index) == sizeof(vtable_index), "precondition");
266267
memcpy(&vtable_index, vtable_index_addr, sizeof(vtable_index));
267268
return hash(is_vtable_stub, vtable_index);
268269
}

0 commit comments

Comments
 (0)
Please sign in to comment.