summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2014-04-24 16:25:36 -0700
committerJeff Hao <jeffhao@google.com>2014-04-24 16:54:45 -0700
commitb878f2133a04593643228eb1d47993092528b963 (patch)
tree0288b9d0eca5e73af456d9dba45d33f0f4c75730 /runtime
parent17c50db442d2791d9c4d7d1e98060556c323ce9b (diff)
downloadart-b878f2133a04593643228eb1d47993092528b963.zip
art-b878f2133a04593643228eb1d47993092528b963.tar.gz
art-b878f2133a04593643228eb1d47993092528b963.tar.bz2
Make unresolved exception types cause soft verification errors.
Before, the verifier would allow the first exception it finds for a catch block to be unresolved, but this causes problems if it merges other exceptions later. The verifier should soft fail for any unresolved exception type it finds. Bug: 14256107 Change-Id: I22563ebfe8c9680cc676b73516d5b48bc9c4ecf3
Diffstat (limited to 'runtime')
-rw-r--r--runtime/verifier/method_verifier.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 535c76d..b6fe4d5 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -2865,11 +2865,7 @@ const RegType& MethodVerifier::GetCaughtExceptionType() {
common_super = &reg_types_.JavaLangThrowable(false);
} else {
const RegType& exception = ResolveClassAndCheckAccess(iterator.GetHandlerTypeIndex());
- if (common_super == NULL) {
- // Unconditionally assign for the first handler. We don't assert this is a Throwable
- // as that is caught at runtime
- common_super = &exception;
- } else if (!reg_types_.JavaLangThrowable(false).IsAssignableFrom(exception)) {
+ if (!reg_types_.JavaLangThrowable(false).IsAssignableFrom(exception)) {
if (exception.IsUnresolvedTypes()) {
// We don't know enough about the type. Fail here and let runtime handle it.
Fail(VERIFY_ERROR_NO_CLASS) << "unresolved exception class " << exception;
@@ -2878,6 +2874,8 @@ const RegType& MethodVerifier::GetCaughtExceptionType() {
Fail(VERIFY_ERROR_BAD_CLASS_SOFT) << "unexpected non-exception class " << exception;
return reg_types_.Conflict();
}
+ } else if (common_super == nullptr) {
+ common_super = &exception;
} else if (common_super->Equals(exception)) {
// odd case, but nothing to do
} else {