RFR: 8333639: ubsan: cppVtables.cpp:81:55: runtime error: index 14 out of bounds for type 'long int [1]' [v2]
Kim Barrett
kbarrett at openjdk.org
Mon Jun 10 20:14:18 UTC 2024
On Mon, 10 Jun 2024 19:31:02 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Martin Doerr has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Flexible array members are not specified by C++.
>
> There are a number of "fake" VLA usage in HotSpot. Some of them have come up in recent ubsan cleanups for similar
> reasons as here. There's a pattern that has been used in at least some of those places. See the class BufferNode in
> share/gc/shared/bufferNode.hpp, for example. It would be nice to only have one pattern for this "feature".
> @kimbarrett: Thanks for taking a look! It makes sense to unify all VLA emulations. The implementation in `BufferNode` looks wrong, too. I believe specifying a length of 1 and accessing beyond it implies UB. Should I change that, too?
I _think_ it's not UB. Or if it is, then I don't see how the mechanism used in the current version of this change isn't
as well. The rationale for that belief is somewhat involved, and I think was discussed elsewhere. I'll see if I can find
or reconstruct it. Part of it is that the single-element `_buffer` is only used to provide the appropriately aligned
offset, with no accesses through that member.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19623#issuecomment-2159199585
More information about the hotspot-runtime-dev
mailing list