harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r470792 - /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_field.cpp
Date Fri, 03 Nov 2006 13:00:10 GMT
Author: gshimansky
Date: Fri Nov  3 05:00:08 2006
New Revision: 470792

URL: http://svn.apache.org/viewvc?view=rev&rev=470792
Log:
Applied HARMONY-1987 [DRLVM] [JVMTI] Insufficient check of fieldID in Field group of JVMTI
functions.

Tests passed on win32 and ubuntu


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

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_field.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_field.cpp?view=diff&rev=470792&r1=470791&r2=470792
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_field.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_field.cpp Fri Nov  3
05:00:08 2006
@@ -60,8 +60,22 @@
     if (! is_valid_class_object(klass))
         return JVMTI_ERROR_INVALID_CLASS;
 
+    Class *cl = jclass_to_struct_Class(klass);
+    if( cl == NULL ) return JVMTI_ERROR_NULL_POINTER;
+
     if( !field ) return JVMTI_ERROR_INVALID_FIELDID; // (25)
 
+    bool present = false;
+    for( unsigned i = 0; i < cl->n_fields; i++ ) {
+        if( (jfieldID)&(cl->fields[i]) == field ) {
+            present = true;
+            break;
+        }
+    }
+
+    if( !present )
+        return JVMTI_ERROR_INVALID_FIELDID;
+
     char* fld_name;
     char* fld_sig;
     Field* fld = reinterpret_cast<Field*>(field);
@@ -125,8 +139,23 @@
 
     if (! is_valid_class_object(klass))
         return JVMTI_ERROR_INVALID_CLASS;
+    
+    Class *cl = jclass_to_struct_Class(klass);
+    if( cl == NULL ) return JVMTI_ERROR_NULL_POINTER;
 
     if( !field ) return JVMTI_ERROR_INVALID_FIELDID;
+
+    bool present = false;
+    for( unsigned i = 0; i < cl->n_fields; i++ ) {
+        if( (jfieldID)&(cl->fields[i]) == field ) {
+            present = true;
+            break;
+        }
+    }
+
+    if( !present )
+        return JVMTI_ERROR_INVALID_FIELDID;
+
     if( !declaring_class_ptr ) return JVMTI_ERROR_NULL_POINTER;
 
     Class* cls = reinterpret_cast<Field*>(field)->get_class();
@@ -164,8 +193,23 @@
 
     if (! is_valid_class_object(klass))
         return JVMTI_ERROR_INVALID_CLASS;
+    
+    Class *cl = jclass_to_struct_Class(klass);
+    if( cl == NULL ) return JVMTI_ERROR_NULL_POINTER;
 
     if( !field ) return JVMTI_ERROR_INVALID_FIELDID;
+
+    bool present = false;
+    for( unsigned i = 0; i < cl->n_fields; i++ ) {
+        if( (jfieldID)&(cl->fields[i]) == field ) {
+            present = true;
+            break;
+        }
+    }
+
+    if( !present )
+        return JVMTI_ERROR_INVALID_FIELDID;
+
     if( !modifiers_ptr ) return JVMTI_ERROR_NULL_POINTER;
 
     *modifiers_ptr = 0;



Mime
View raw message