summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/openjdkjvmti/ti_class.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/openjdkjvmti/ti_class.cc b/runtime/openjdkjvmti/ti_class.cc
index 0ac08d9cb8..b8e79555ae 100644
--- a/runtime/openjdkjvmti/ti_class.cc
+++ b/runtime/openjdkjvmti/ti_class.cc
@@ -598,6 +598,13 @@ jvmtiError ClassUtil::GetClassFields(jvmtiEnv* env,
return ERR(INVALID_CLASS);
}
+ // Check if this class is a temporary class object used for loading. Since we are seeing it the
+ // class must not have been prepared yet since otherwise the fixup would have gotten the jobject
+ // to point to the final class object.
+ if (klass->IsTemp() || klass->IsRetired()) {
+ return ERR(CLASS_NOT_PREPARED);
+ }
+
if (field_count_ptr == nullptr || fields_ptr == nullptr) {
return ERR(NULL_POINTER);
}
@@ -639,6 +646,13 @@ jvmtiError ClassUtil::GetClassMethods(jvmtiEnv* env,
return ERR(INVALID_CLASS);
}
+ // Check if this class is a temporary class object used for loading. Since we are seeing it the
+ // class must not have been prepared yet since otherwise the fixup would have gotten the jobject
+ // to point to the final class object.
+ if (klass->IsTemp() || klass->IsRetired()) {
+ return ERR(CLASS_NOT_PREPARED);
+ }
+
if (method_count_ptr == nullptr || methods_ptr == nullptr) {
return ERR(NULL_POINTER);
}