summaryrefslogtreecommitdiffstats
path: root/compiler
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-11-22 00:57:04 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-11-22 00:57:04 +0000
commitda4b7e8979e9b7de634aecee62da6ce867ccaa8d (patch)
tree30231057eb355c958a991ad1555301e68a9887e9 /compiler
parent819b3c05b1553dfd9fbde5fdb8f4cf77b5689682 (diff)
parentf41b92c7a2fcdd411b9edd7070e4729ea18e0ba6 (diff)
downloadart-da4b7e8979e9b7de634aecee62da6ce867ccaa8d.tar.gz
art-da4b7e8979e9b7de634aecee62da6ce867ccaa8d.tar.bz2
art-da4b7e8979e9b7de634aecee62da6ce867ccaa8d.zip
Merge "Fix possible array access issue"
Diffstat (limited to 'compiler')
-rw-r--r--compiler/dex/mir_graph.cc4
-rw-r--r--compiler/utils/scoped_arena_allocator.cc1
2 files changed, 5 insertions, 0 deletions
diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc
index 29972ddba5..f69d63c135 100644
--- a/compiler/dex/mir_graph.cc
+++ b/compiler/dex/mir_graph.cc
@@ -1209,6 +1209,10 @@ void MIRGraph::DisassembleExtendedInstr(const MIR* mir, std::string* decoded_mir
int defs = (ssa_rep != nullptr) ? ssa_rep->num_defs : 0;
int uses = (ssa_rep != nullptr) ? ssa_rep->num_uses : 0;
+ if (opcode < kMirOpFirst) {
+ return; // It is not an extended instruction.
+ }
+
decoded_mir->append(extended_mir_op_names_[opcode - kMirOpFirst]);
switch (opcode) {
diff --git a/compiler/utils/scoped_arena_allocator.cc b/compiler/utils/scoped_arena_allocator.cc
index 26161501b3..d9e0619de6 100644
--- a/compiler/utils/scoped_arena_allocator.cc
+++ b/compiler/utils/scoped_arena_allocator.cc
@@ -96,6 +96,7 @@ void* ArenaStack::AllocValgrind(size_t bytes, ArenaAllocKind kind) {
uint8_t* ptr = top_ptr_;
if (UNLIKELY(static_cast<size_t>(top_end_ - ptr) < rounded_bytes)) {
ptr = AllocateFromNextArena(rounded_bytes);
+ CHECK(ptr != nullptr) << "Failed to allocate memory";
}
CurrentStats()->RecordAlloc(bytes, kind);
top_ptr_ = ptr + rounded_bytes;