Index: base/debug/stack_trace_win.cc |
diff --git a/base/debug/stack_trace_win.cc b/base/debug/stack_trace_win.cc |
index 9369663b95a1ca02a9b9250802c3f95bd2485224..1d7c2b3c6ce2342c8e1b37d49b49368ca62d9462 100644 |
--- a/base/debug/stack_trace_win.cc |
+++ b/base/debug/stack_trace_win.cc |
@@ -8,6 +8,7 @@ |
#include <dbghelp.h> |
#include <stddef.h> |
+#include <algorithm> |
#include <iostream> |
#include <memory> |
@@ -209,9 +210,11 @@ bool EnableInProcessStackDumping() { |
#pragma optimize("", off) |
#endif |
-StackTrace::StackTrace() { |
+StackTrace::StackTrace(size_t count) { |
+ count = std::min(arraysize(trace_), count); |
+ |
// When walking our own stack, use CaptureStackBackTrace(). |
- count_ = CaptureStackBackTrace(0, arraysize(trace_), trace_, NULL); |
+ count_ = CaptureStackBackTrace(0, count, trace_, NULL); |
} |
#if defined(COMPILER_MSVC) |