RFR: 8333639: ubsan: cppVtables.cpp:81:55: runtime error: index 14 out of bounds for type 'long int [1]' [v3]

Kim Barrett kbarrett at openjdk.org
Sat Jun 15 18:17:13 UTC 2024


On Sat, 15 Jun 2024 09:57:46 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> src/hotspot/share/cds/cppVtables.cpp line 79:
>> 
>>> 77:   intptr_t* cloned_vtable()   { return (intptr_t*)((char*)this + offset_of(CppVtableInfo, _cloned_vtable)); }
>>> 78:   void zero()                 { memset(cloned_vtable(), 0, sizeof(intptr_t) * vtable_size()); }
>>> 79:   // Returns the address of the next CppVtableInfo that can be placed immediately after this CppVtableInfo
>> 
>> The description of this function is wrong, as it returns an offset rather than
>> an address.
>
> It returns a pointer which is computed by base + offset. I've factored out the offset computation.

The comment says `byte_size()` returns an address, but it actually returns a size_t offset.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19623#discussion_r1641343979


More information about the hotspot-runtime-dev mailing list