aboutsummaryrefslogtreecommitdiff
path: root/src/processor/exploitability_win.cc
diff options
context:
space:
mode:
authorLiu.andrew.x@gmail.com <Liu.andrew.x@gmail.com>2015-06-30 23:22:09 +0000
committerLiu.andrew.x@gmail.com <Liu.andrew.x@gmail.com>2015-06-30 23:22:09 +0000
commite2eb4505d0ea073d031b4a886a35cb3ce0caf197 (patch)
tree765dbea4fe941a8d6d7d7527149c76bce4c9a0c3 /src/processor/exploitability_win.cc
parentChecking for benign exceptions that trigger a minidump. (diff)
downloadbreakpad-e2eb4505d0ea073d031b4a886a35cb3ce0caf197.tar.xz
Use general instruction/stack pointer convenience method instead of manually
finding the instruction/stack pointer for exploitability rating. There was already a method that found the instruction pointer, so the files for exploitability ratings had repeated code. Also a method for finding the stack pointer is implemented in this CL. R=ivanpe@chromium.org Review URL: https://codereview.chromium.org/1210943005 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1468 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/processor/exploitability_win.cc')
-rw-r--r--src/processor/exploitability_win.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/processor/exploitability_win.cc b/src/processor/exploitability_win.cc
index 8a444eb2..a1f8703a 100644
--- a/src/processor/exploitability_win.cc
+++ b/src/processor/exploitability_win.cc
@@ -106,18 +106,14 @@ ExploitabilityRating ExploitabilityWin::CheckPlatformExploitability() {
uint64_t stack_ptr = 0;
uint64_t instruction_ptr = 0;
- switch (context->GetContextCPU()) {
- case MD_CONTEXT_X86:
- stack_ptr = context->GetContextX86()->esp;
- instruction_ptr = context->GetContextX86()->eip;
- break;
- case MD_CONTEXT_AMD64:
- stack_ptr = context->GetContextAMD64()->rsp;
- instruction_ptr = context->GetContextAMD64()->rip;
- break;
- default:
- BPLOG(INFO) << "Unsupported architecture.";
- return EXPLOITABILITY_ERR_PROCESSING;
+ // Getting the instruction pointer.
+ if (!context->GetInstructionPointer(&instruction_ptr)) {
+ return EXPLOITABILITY_ERR_PROCESSING;
+ }
+
+ // Getting the stack pointer.
+ if (!context->GetStackPointer(&stack_ptr)) {
+ return EXPLOITABILITY_ERR_PROCESSING;
}
// Check if we are executing on the stack.