8210235: JvmtiTrace::safe_get_current_thread_name is unsafe in debug builds
Summary: Use Thread::current_or_null and handle NULL result.
Reviewed-by: coleenp
--- a/src/hotspot/share/prims/jvmtiTrace.cpp Fri Aug 31 11:56:43 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiTrace.cpp Fri Aug 31 16:29:49 2018 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -291,7 +291,7 @@
// return the name of the current thread
const char *JvmtiTrace::safe_get_current_thread_name() {
if (JvmtiEnv::is_vm_live()) {
- return JvmtiTrace::safe_get_thread_name(Thread::current());
+ return JvmtiTrace::safe_get_thread_name(Thread::current_or_null());
} else {
return "VM not live";
}