RFR: 8331920: ubsan: g1CardSetContainers.inline.hpp:266:5: runtime error: index 2 out of bounds for type 'G1CardSetHowl::ContainerPtr [2]' reported [v2]
Thomas Schatzl
tschatzl at openjdk.org
Wed May 22 10:17:04 UTC 2024
On Wed, 22 May 2024 07:56:15 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:
>> Hi all,
>>
>> Please review this change to improve access to G1CardSetContainer VLA elements. Instead of straightforward indexing, we obscure access through a base pointer and offsets to reduce the possibility of UB.
>>
>> Testing: Tier 1-3
>> - Local testing on Mac with `--enable-ubsan`.
>
> Ivan Walulya has updated the pull request incrementally with one additional commit since the last revision:
>
> Axel suggestion
Still good.
One of the new methods could be made const, but feel free to ignore (and sorry for noticing a bit late)
src/hotspot/share/gc/g1/g1CardSetContainers.hpp line 250:
> 248: void iterate_cardset(ContainerPtr const container, uint index, CardOrRangeVisitor& found, G1CardSetConfiguration* config);
> 249:
> 250: ContainerPtr at(EntryCountType index);
Could be made `const`, i.e.
Suggestion:
ContainerPtr at(EntryCountType index) const;
-------------
Marked as reviewed by tschatzl (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/19300#pullrequestreview-2070766179
PR Review Comment: https://git.openjdk.org/jdk/pull/19300#discussion_r1609687736
More information about the hotspot-gc-dev
mailing list