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

Unified Diff: base/trace_event/heap_profiler_allocation_context_tracker.cc

Issue 1927963003: [tracing] Don't pop context from an empty stack. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix oops Created 4 years, 8 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/trace_event/heap_profiler_allocation_context_tracker.cc
diff --git a/base/trace_event/heap_profiler_allocation_context_tracker.cc b/base/trace_event/heap_profiler_allocation_context_tracker.cc
index e192bc833fd950507a5756387b84b5fc92e827ed..46d30acffa3a9f2a85a678ccf0af3ef899465844 100644
--- a/base/trace_event/heap_profiler_allocation_context_tracker.cc
+++ b/base/trace_event/heap_profiler_allocation_context_tracker.cc
@@ -113,6 +113,12 @@ void AllocationContextTracker::PushCurrentTaskContext(const char* context) {
}
void AllocationContextTracker::PopCurrentTaskContext(const char* context) {
+ // Guard for stack underflow. If tracing was started with a TRACE_EVENT in
+ // scope, the context was never pushed, so it is possible that pop is called
+ // on an empty stack.
+ if (task_contexts_.empty())
+ return;
+
DCHECK_EQ(context, task_contexts_.back())
Primiano Tucci (use gerrit) 2016/04/29 12:02:36 ok following this logic (that is correcT) we shoul
ssid 2016/04/29 12:10:44 This check is still valid because the contexts can
<< "Encountered an unmatched context end";
task_contexts_.pop_back();
« 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