summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2017-06-30 19:21:10 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-06-30 19:21:10 +0000
commitd449cc10a19cf2ceec45ce89b6cfd2b50b1ca79a (patch)
treeca9ff6bb9e946acaff00ede26f84858669846606
parente9c23417376179e86d9ee3710e1bb9c028169227 (diff)
parent2c6cd691e4fe47c3f4c651d56fe50b0a3d9bb576 (diff)
Merge "Check for temporary and retired classes in GetClassFields."
-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);
}