aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectMemory.cpp
diff options
context:
space:
mode:
authorChelsea Cassanova <sassychels251@gmail.com>2022-06-03 20:04:13 -0400
committerChelsea Cassanova <sassychels251@gmail.com>2022-06-08 18:10:41 -0400
commit0f02dd34f22650d8af0070e7ad21632525e33da8 (patch)
tree211f62fc375350925d83a27fd4d7dd503e98c090 /lldb/source/Commands/CommandObjectMemory.cpp
parentff96d434d0cdc9ba5b367c9776f6dfd95de70a81 (diff)
downloadllvm-0f02dd34f22650d8af0070e7ad21632525e33da8.zip
llvm-0f02dd34f22650d8af0070e7ad21632525e33da8.tar.gz
llvm-0f02dd34f22650d8af0070e7ad21632525e33da8.tar.bz2
[lldb/Commands] Prevent crash due to reading memory from page zero.
Adds a check to ensure that a process exists before attempting to get its ABI to prevent lldb from crashing due to trying to read from page zero. Differential revision: https://reviews.llvm.org/D127016
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index b7678ad..ab54578 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -592,7 +592,10 @@ protected:
return false;
}
- ABISP abi = m_exe_ctx.GetProcessPtr()->GetABI();
+ ABISP abi;
+ if (Process *proc = m_exe_ctx.GetProcessPtr())
+ abi = proc->GetABI();
+
if (abi)
addr = abi->FixDataAddress(addr);