harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r448392 - /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp
Date Wed, 20 Sep 2006 22:55:51 GMT
Author: geirm
Date: Wed Sep 20 15:55:51 2006
New Revision: 448392

URL: http://svn.apache.org/viewvc?view=rev&rev=448392
Log:
HARMONY-1452

jvmtiStopThread method does not check error conditions such as:
       - given thread is alive
       - exception object is valid 

tested on ubuntu 6 (smoke and c-unit)


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp?view=diff&rev=448392&r1=448391&r2=448392
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp Wed Sep 20
15:55:51 2006
@@ -382,6 +382,8 @@
 
     CHECK_EVERYTHING();
 
+    jint state;
+    
     jvmtiCapabilities capa;
 
     jvmtiError err = env -> GetCapabilities(&capa);
@@ -395,6 +397,30 @@
     if (!is_valid_thread_object(thread)){
         return JVMTI_ERROR_INVALID_THREAD;
     }
+
+    err = jvmtiGetThreadState(env, thread, &state);
+
+    if (err != JVMTI_ERROR_NONE){
+        return err;
+    }
+    if ((state & JVMTI_THREAD_STATE_ALIVE) == 0){
+        return JVMTI_ERROR_THREAD_NOT_ALIVE;
+    }
+
+    if (exception == NULL) return JVMTI_ERROR_INVALID_OBJECT;
+    tmn_suspend_disable();       //---------------------------------v
+    ObjectHandle h = (ObjectHandle)exception;
+    ManagedObject *mo = h->object;
+
+    // Check that reference pointer points to the heap
+    if (mo < (ManagedObject *)Class::heap_base ||
+        mo > (ManagedObject *)Class::heap_end)
+    {
+        tmn_suspend_enable();
+        return JVMTI_ERROR_INVALID_OBJECT;
+    }
+
+    tmn_suspend_enable();       //---------------------------------^
 
     return (jvmtiError)jthread_exception_stop(thread, exception);
 }



Mime
View raw message