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

Unified Diff: base/debug/stack_trace.cc

Issue 2692123005: Fix stack walking to notice if the frame is obviously not valid. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/stack_trace.cc
diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc
index 94ff7d0755ab50a650ebcee9dfbe05ab287972b2..6c3940456e9f79969fd16ddf4a93af4cdd4307ea 100644
--- a/base/debug/stack_trace.cc
+++ b/base/debug/stack_trace.cc
@@ -111,12 +111,13 @@ bool IsStackFrameValid(uintptr_t fp, uintptr_t prev_fp, uintptr_t stack_end) {
// Check alignment.
if (fp & (sizeof(uintptr_t) - 1)) return false;
+ // A PC that is too small means we've gone off the end of the stack.
+ if (GetStackFramePC(fp) < 32768)
Mark Mentovai 2017/02/15 21:05:57 You could go even bigger. On x86_64, you’ll genera
erikchen 2017/02/15 21:52:45 Also, this is run on all plaforms.
Wez 2017/02/15 22:38:22 Maybe use a kConstant here, so we can define it to
erikchen 2017/02/15 22:52:24 Done.
+ return false;
+
if (stack_end) {
// Both fp[0] and fp[1] must be within the stack.
if (fp > stack_end - 2 * sizeof(uintptr_t)) return false;
-
- // Additional check to filter out false positives.
- if (GetStackFramePC(fp) < 32768) return false;
}
return true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698