ART: Method verifier needs to check 2-reg values

The method verifier did not check against the second register
for a J or D parameter from a method signature.

The register line had a wrong DCHECK that did not catch this even
in debug mode.

Bug: 15751498
Change-Id: Ic6af08bf4704b3ab0f308dd9f0da28691a4cb024
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index c9c3bba..f8e75ea 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -1219,6 +1219,12 @@
         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 d21f39b..556056c 100644
--- a/runtime/verifier/register_line.cc
+++ b/runtime/verifier/register_line.cc
@@ -55,7 +55,7 @@
 
 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 << "'";