> FollowReferences function has unreachable code. The null check was 
> incorrectly applied to the klass variable inside a block where klass is 
> already guaranteed to be non-null. Because of this, the check was always 
> false, and the extracted internal Klass* pointer (k) was left unchecked, 
> which could lead to a null pointer dereference.
> 
> Since k_mirror is checked for null and primitive types earlier in the 
> function, java_lang_Class::as_Klass(k_mirror) is guaranteed to return a 
> non-null Klass* pointer. Therefore, the typo'd dead code is removed and 
> replaced with an assert to uphold this invariant.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Timofei has updated the pull request incrementally with two additional commits 
since the last revision:

 - Add assert in place of the unreachable code in JvmtiEnv::FollowReferences
 - Delete regression test

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/32253/files
  - new: https://git.openjdk.org/jdk/pull/32253/files/385133c8..8d398700

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=32253&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=32253&range=01-02

  Stats: 103 lines in 3 files changed: 1 ins; 102 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/32253.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32253/head:pull/32253

PR: https://git.openjdk.org/jdk/pull/32253

Reply via email to