summaryrefslogtreecommitdiffstats
path: root/runtime/interpreter
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-04-14 10:10:33 -0700
committerAndreas Gampe <agampe@google.com>2015-04-14 10:11:06 -0700
commitbf4d3afaf5b408eae7bbd693054447e9b2487505 (patch)
tree376293a3ead59084af08a5ae2a8c7e76df12cc9d /runtime/interpreter
parente015a31e509c3f4de8a90b57b77329ba6609ce2f (diff)
downloadart-bf4d3afaf5b408eae7bbd693054447e9b2487505.zip
art-bf4d3afaf5b408eae7bbd693054447e9b2487505.tar.gz
art-bf4d3afaf5b408eae7bbd693054447e9b2487505.tar.bz2
ART: Add a null-check to unstarted-runtime
Check the string parameter to Class.forName before using it. Bug: 19542228 Change-Id: I0d5c44122055c46e251451b1c0f687bbaf64d13e
Diffstat (limited to 'runtime/interpreter')
-rw-r--r--runtime/interpreter/unstarted_runtime.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc
index 4fb634b..a971c1b 100644
--- a/runtime/interpreter/unstarted_runtime.cc
+++ b/runtime/interpreter/unstarted_runtime.cc
@@ -123,7 +123,12 @@ static void UnstartedClassForName(
static void UnstartedClassForNameLong(
Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- mirror::String* class_name = shadow_frame->GetVRegReference(arg_offset)->AsString();
+ mirror::Object* param = shadow_frame->GetVRegReference(arg_offset);
+ if (param == nullptr) {
+ AbortTransactionOrFail(self, "Null-pointer in Class.forName.");
+ return;
+ }
+ mirror::String* class_name = param->AsString();
bool initialize_class = shadow_frame->GetVReg(arg_offset + 1) != 0;
mirror::ClassLoader* class_loader =
down_cast<mirror::ClassLoader*>(shadow_frame->GetVRegReference(arg_offset + 2));