summaryrefslogtreecommitdiffstats
path: root/runtime/interpreter
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2015-03-20 19:44:35 -0700
committerJeff Hao <jeffhao@google.com>2015-03-20 19:44:35 -0700
commit935e01a1e4c0f0ac257c5a9b71bda50a9d441fa3 (patch)
tree9b79b902c9ca4443561aba439122fd0be65900a6 /runtime/interpreter
parent7aa81a451386350dd03c98adfade2ed7b88f611e (diff)
downloadart-935e01a1e4c0f0ac257c5a9b71bda50a9d441fa3.tar.gz
art-935e01a1e4c0f0ac257c5a9b71bda50a9d441fa3.tar.bz2
art-935e01a1e4c0f0ac257c5a9b71bda50a9d441fa3.zip
Fix interpreter to allow 0 size sparse switches.
Bug: 19827056 Change-Id: I12eaf717f1a4b9bd5e0c8e2a508df9da4e61c4ec
Diffstat (limited to 'runtime/interpreter')
-rw-r--r--runtime/interpreter/interpreter_common.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index 15396d6e90..7d413c5d40 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -317,7 +317,10 @@ static inline int32_t DoSparseSwitch(const Instruction* inst, const ShadowFrame&
int32_t test_val = shadow_frame.GetVReg(inst->VRegA_31t(inst_data));
DCHECK_EQ(switch_data[0], static_cast<uint16_t>(Instruction::kSparseSwitchSignature));
uint16_t size = switch_data[1];
- DCHECK_GT(size, 0);
+ // Return length of SPARSE_SWITCH if size is 0.
+ if (size == 0) {
+ return 3;
+ }
const int32_t* keys = reinterpret_cast<const int32_t*>(&switch_data[2]);
DCHECK(IsAligned<4>(keys));
const int32_t* entries = keys + size;