summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/verifier/method_verifier.cc6
-rw-r--r--runtime/verifier/register_line.cc2
2 files changed, 7 insertions, 1 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index c9c3bbabdf..f8e75ea850 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -1219,6 +1219,12 @@ bool MethodVerifier::SetTypesFromSignature() {
break;
case 'J':
case 'D': {
+ if (cur_arg + 1 >= expected_args) {
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "expected " << expected_args
+ << " args, found more (" << descriptor << ")";
+ return false;
+ }
+
const RegType& lo_half = descriptor[0] == 'J' ? reg_types_.LongLo() : reg_types_.DoubleLo();
const RegType& hi_half = descriptor[0] == 'J' ? reg_types_.LongHi() : reg_types_.DoubleHi();
reg_line->SetRegisterTypeWide(arg_start + cur_arg, lo_half, hi_half);
diff --git a/runtime/verifier/register_line.cc b/runtime/verifier/register_line.cc
index d21f39bf67..556056ce04 100644
--- a/runtime/verifier/register_line.cc
+++ b/runtime/verifier/register_line.cc
@@ -55,7 +55,7 @@ bool RegisterLine::SetRegisterType(uint32_t vdst, const RegType& new_type) {
bool RegisterLine::SetRegisterTypeWide(uint32_t vdst, const RegType& new_type1,
const RegType& new_type2) {
- DCHECK_LT(vdst, num_regs_);
+ DCHECK_LT(vdst + 1, num_regs_);
if (!new_type1.CheckWidePair(new_type2)) {
verifier_->Fail(VERIFY_ERROR_BAD_CLASS_SOFT) << "Invalid wide pair '"
<< new_type1 << "' '" << new_type2 << "'";