RFR: JDK-8263557: Possible NULL dereference in Arena::destruct_contents()
Kim Barrett
kbarrett at openjdk.java.net
Sun Mar 14 19:56:08 UTC 2021
On Sun, 14 Mar 2021 06:07:00 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> Trivial.
>
> Sonarcloud reports a possible access to a NULL C++ object in Arena::destruct_contents():
>
> _first->chop();
>
> I have found no code path where this could happen but _first could conceivably be NULL after a call to Arena::reset(). Lets fix that.
>
> GA test error on windows seems unrelated.
Arena::move_contents leaves _first == nullptr. ~Arena calls destruct_contents. Calling ~Arena on a moved-from arena would hit this. So change looks good, though I'm not so sure about "trivial".
I'm not sure why we don't hit this. C2 (in Matcher::match) calls move_contents, but I couldn't figure out what it did with the old (moved-from) arena after that.
-------------
Marked as reviewed by kbarrett (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2994
More information about the hotspot-runtime-dev
mailing list