RFR: 8360664: Null pointer dereference in src/hotspot/share/prims/jvmtiTagMap.cpp in IterateOverHeapObjectClosure::do_object() [v2]

Chris Plummer cjplummer at openjdk.org
Fri Jun 27 17:31:38 UTC 2025


On Fri, 27 Jun 2025 12:06:21 GMT, Artem Semenov <asemenov at openjdk.org> wrote:

> > > At most I would add an assert, but generally my understanding is that the user of any closure has the responsibility of passing it valid input.
> > 
> > 
> > Adding asserts sounds like a good suggestion.
> 
> It seems to me that this won’t be a big problem in this form. I’ve just moved the existing check higher up, where it will prevent dereferencing a null pointer.
> 
> However, if you confirm that this is not acceptable, I will replace the check with assert.

I think it is a matter of having the code accurately document the input requirements. Checking for null and returning makes it look like passing null is ok and might happen. That's not the case though. It should never happen and adding an assert properly documents this.

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

PR Comment: https://git.openjdk.org/jdk/pull/26002#issuecomment-3013875492


More information about the serviceability-dev mailing list