JDWP: check object is assignable in ArrayReference.SetValues
If the object's type is not compatible with the array's type, we
return a TYPE_MISMATCH error.
Bug: 23602995
Change-Id: Ibd838dd301e40db4f08c74c9783707d1c87c67fd
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 0cbbb79..d9fbecc 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -1191,6 +1191,10 @@
if (error != JDWP::ERR_NONE) {
return error;
}
+ // Check if the object's type is compatible with the array's type.
+ if (o != nullptr && !o->InstanceOf(oa->GetClass()->GetComponentType())) {
+ return JDWP::ERR_TYPE_MISMATCH;
+ }
oa->Set<false>(offset + i, o);
}
}