Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(948)

Unified Diff: src/processor/exploitability_win.cc

Issue 1210943005: Use general instruction/stack pointer convenience method instead of manually (Closed) Base URL: http://google-breakpad.googlecode.com/svn/trunk/
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/processor/exploitability_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/processor/exploitability_win.cc
===================================================================
--- src/processor/exploitability_win.cc (revision 1466)
+++ src/processor/exploitability_win.cc (working copy)
@@ -106,20 +106,16 @@
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.
if (instruction_ptr <= (stack_ptr + kProbableStackOffset) &&
instruction_ptr >= (stack_ptr - kProbableStackOffset))
« no previous file with comments | « src/processor/exploitability_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698