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

Martin Doerr mdoerr at openjdk.org
Mon Jun 17 10:34:40 UTC 2024


On Sat, 15 Jun 2024 18:16:29 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Martin Doerr has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Factor out cloned_vtable_offs().
>
> src/hotspot/share/cds/cppVtables.cpp line 70:
> 
>> 68:   intptr_t _vtable_size;
>> 69:   intptr_t _cloned_vtable[1]; // Pseudo flexible array member.
>> 70:   static size_t cloned_vtable_offs() { return offset_of(CppVtableInfo, _cloned_vtable); }
> 
> I'd really prefer spelling out "offset" rather than saving two characters with the "offs" abbreviation.

Sure. I don't mind.

> src/hotspot/share/cds/cppVtables.cpp line 73:
> 
>> 71: public:
>> 72:   static int num_slots(int vtable_size) {
>> 73:     return 1 + vtable_size; // Need to add the space occupied by _vtable_size;
> 
> Pre-existing: Maybe this ought to be `byte_size() / sizeof(intptr_t)` or something like that? And the
> name `num_slots` seems confusing for what this is doing.  Do we actually need both `byte_size`
> and `num_slots`?

`num_slots` is unused. Removed.

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

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


More information about the hotspot-runtime-dev mailing list