ART: Avoid obvious segfault in arm & x86 fault handler
These handlers need to read an instruction to determine where to
look for info. Don't try to read from pc=0.
Bug: 20040863
Change-Id: I38b56dc6dd806df22e608ee8d46c4091a738e4bc
diff --git a/runtime/arch/x86/fault_handler_x86.cc b/runtime/arch/x86/fault_handler_x86.cc
index ad962e2..27a4adf 100644
--- a/runtime/arch/x86/fault_handler_x86.cc
+++ b/runtime/arch/x86/fault_handler_x86.cc
@@ -275,6 +275,12 @@
uint8_t* pc = reinterpret_cast<uint8_t*>(uc->CTX_EIP);
VLOG(signals) << HexDump(pc, 32, true, "PC ");
+ if (pc == nullptr) {
+ // Somebody jumped to 0x0. Definitely not ours, and will definitely segfault below.
+ *out_method = nullptr;
+ return;
+ }
+
uint32_t instr_size = GetInstructionSize(pc);
if (instr_size == 0) {
// Unknown instruction, tell caller it's not ours.