6800721: 3/4 JavaThread::jvmti_thread_state() and JvmtiThreadState::state_for() robustness

Check for NULL return values from jvmti_thread_state() and state_for() and return a JVM TI error code as appropriate.

Reviewed-by: coleenp, swamyv
This commit is contained in:
Daniel D. Daugherty 2009-03-02 14:00:23 -07:00
parent 74a99e1e82
commit 56fe18e375
7 changed files with 47 additions and 7 deletions

View file

@ -1322,6 +1322,12 @@ JvmtiEnvBase::force_early_return(JavaThread* java_thread, jvalue value, TosState
HandleMark hm(current_thread);
uint32_t debug_bits = 0;
// retrieve or create the state
JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread);
if (state == NULL) {
return JVMTI_ERROR_THREAD_NOT_ALIVE;
}
// Check if java_thread is fully suspended
if (!is_thread_fully_suspended(java_thread,
true /* wait for suspend completion */,
@ -1329,9 +1335,6 @@ JvmtiEnvBase::force_early_return(JavaThread* java_thread, jvalue value, TosState
return JVMTI_ERROR_THREAD_NOT_SUSPENDED;
}
// retreive or create the state
JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread);
// Check to see if a ForceEarlyReturn was already in progress
if (state->is_earlyret_pending()) {
// Probably possible for JVMTI clients to trigger this, but the