Fix bug in verifier: soft fail was hiding hard fail.
Rationale:
Dexfuzzing found a situation where a soft fail (modifying
a final field) was hiding a hard fail (type error on that
field), which caused a crash in the compiler later on.
Also added a crash-before/pass-after regression test,
so we don't add the return by accident later.
BUG=28908555
Change-Id: I0cdc400be22a2d9eb00db8c8c6b25a85fbdac993
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 2b96328..b2be770 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -4652,7 +4652,7 @@
if (field->IsFinal() && field->GetDeclaringClass() != GetDeclaringClass().GetClass()) {
Fail(VERIFY_ERROR_ACCESS_FIELD) << "cannot modify final field " << PrettyField(field)
<< " from other class " << GetDeclaringClass();
- return;
+ // Keep hunting for possible hard fails.
}
}