Skip to content

Commit

Permalink
8333149: ubsan : memset on nullptr target detected in jvmtiEnvBase.cp…
Browse files Browse the repository at this point in the history
…p get_object_monitor_usage

Backport-of: 43a2f17342af8f5bf1f5823df9fa0bf0bdfdfce2
  • Loading branch information
MBaesken committed Aug 22, 2024
1 parent dc8365c commit 24f453c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/hotspot/share/prims/jvmtiEnvBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1515,8 +1515,12 @@ JvmtiEnvBase::get_object_monitor_usage(JavaThread* calling_thread, jobject objec

// Number of waiters may actually be less than the waiter count.
// So null out memory so that unused memory will be null.
memset(ret.waiters, 0, ret.waiter_count * sizeof(jthread *));
memset(ret.notify_waiters, 0, ret.notify_waiter_count * sizeof(jthread *));
if (ret.waiters != nullptr) {
memset(ret.waiters, 0, ret.waiter_count * sizeof(jthread *));
}
if (ret.notify_waiters != nullptr) {
memset(ret.notify_waiters, 0, ret.notify_waiter_count * sizeof(jthread *));
}

if (ret.waiter_count > 0) {
// we have contending and/or waiting threads
Expand Down

1 comment on commit 24f453c

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.