Fix possible array access issue
The issue with possible array access in the DisassembleExtendedInstr
method should be fixed. The input opcode should be extended one.
Additional check for it was added.
Also additional CHECK for memory allocation should be added.
Change-Id: If114572a5bc99587d5effd588e7bd955c16d8318
Signed-off-by: Vladimir <vladimir.a.ivanov@intel.com>
diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc
index 29972dd..f69d63c 100644
--- a/compiler/dex/mir_graph.cc
+++ b/compiler/dex/mir_graph.cc
@@ -1209,6 +1209,10 @@
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) {