1 Star 0 Fork 13

佛系少年中二/openjdk-21

forked from src-openEuler/openjdk-21 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Backport-JDK-8333149-ubsan-memset-on-nullptr-target-.patch 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
wuyafang 提交于 2024-10-14 11:38 . sync bishengjdk21 patches
Subject: Backport of JDK-8333149 ubsan : memset on nullptr target detected in jvmtiEnvBase.cpp get_object_monitor_usage
---
src/hotspot/share/prims/jvmtiEnvBase.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/hotspot/share/prims/jvmtiEnvBase.cpp b/src/hotspot/share/prims/jvmtiEnvBase.cpp
index 7c67a0eeb..d4b924b78 100644
--- a/src/hotspot/share/prims/jvmtiEnvBase.cpp
+++ b/src/hotspot/share/prims/jvmtiEnvBase.cpp
@@ -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
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Autistic_boyya/openjdk-21.git
[email protected]:Autistic_boyya/openjdk-21.git
Autistic_boyya
openjdk-21
openjdk-21
master

搜索帮助