diff options
author | 2017-06-30 07:34:40 -0700 | |
---|---|---|
committer | 2017-06-30 09:45:51 -0700 | |
commit | 2c6cd691e4fe47c3f4c651d56fe50b0a3d9bb576 (patch) | |
tree | 3add15e01f06fe2154a74c1a61522065c093c14f | |
parent | fe9a4f061841a3c597aac6817a47c799c54fcad7 (diff) |
Check for temporary and retired classes in GetClassFields.
Bug: 62895303
Bug: 62902528
Test: stress --cpu 70 &; \
while ./test/run-test --host --jit 990; do ; done
Change-Id: I623ed0a23e8ffb3c191ef66b8e3f101f3aca427f
-rw-r--r-- | runtime/openjdkjvmti/ti_class.cc | 14 |
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); } |