diff options
author | Jeff Hao <jeffhao@google.com> | 2015-03-20 18:11:45 -0700 |
---|---|---|
committer | Jeff Hao <jeffhao@google.com> | 2015-03-20 18:40:32 -0700 |
commit | 9ccd151d0d27a729f88af9d00285afe4d147981a (patch) | |
tree | edfef268a0ecda957dfaa91ec35dd99c9ad3761f /runtime/verifier | |
parent | 3743174267159ec0c39bce1ca28c2081468dda94 (diff) | |
download | art-9ccd151d0d27a729f88af9d00285afe4d147981a.zip art-9ccd151d0d27a729f88af9d00285afe4d147981a.tar.gz art-9ccd151d0d27a729f88af9d00285afe4d147981a.tar.bz2 |
Fix verifier handling of empty switch as last instruction.
Also fixes optimizing compiler's assumption that switch is non-empty and
adds test case.
Bug: 19827056
Change-Id: I5ac891d5062f528ef3be787b1094cba7b4c0fbd0
Diffstat (limited to 'runtime/verifier')
-rw-r--r-- | runtime/verifier/method_verifier.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index 3b98e47..47e9bf5 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -1086,7 +1086,7 @@ bool MethodVerifier::CheckSwitchTargets(uint32_t cur_offset) { const uint16_t* insns = code_item_->insns_ + cur_offset; /* make sure the start of the switch is in range */ int32_t switch_offset = insns[1] | ((int32_t) insns[2]) << 16; - if ((int32_t) cur_offset + switch_offset < 0 || cur_offset + switch_offset + 2 >= insn_count) { + if ((int32_t) cur_offset + switch_offset < 0 || cur_offset + switch_offset + 2 > insn_count) { Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid switch start: at " << cur_offset << ", switch offset " << switch_offset << ", count " << insn_count; |