diff options
author | thestig@chromium.org <thestig@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-08-26 21:38:51 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-08-26 21:38:51 +0000 |
commit | 8e77c078d68ebd25d70f92f70a5aa630b19c7ee2 (patch) | |
tree | b8db1ab22c61a7e3c8540c83c6a688d9c0606041 /src/processor | |
parent | Issue 176001: Add package to process_state.proto to prevent name clashes. (diff) | |
download | breakpad-8e77c078d68ebd25d70f92f70a5aa630b19c7ee2.tar.xz |
Limit the number of frames we try to walk to prevent runaway processors.
Review URL: http://breakpad.appspot.com/175001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@672 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/processor')
-rw-r--r-- | src/processor/stackwalker.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc index 8552e2f3..39eb65ec 100644 --- a/src/processor/stackwalker.cc +++ b/src/processor/stackwalker.cc @@ -55,6 +55,7 @@ namespace google_breakpad { +u_int32_t Stackwalker::max_frames_ = 1024; Stackwalker::Stackwalker(const SystemInfo *system_info, MemoryRegion *memory, @@ -120,6 +121,10 @@ bool Stackwalker::Walk(CallStack *stack) { // Add the frame to the call stack. Relinquish the ownership claim // over the frame, because the stack now owns it. stack->frames_.push_back(frame.release()); + if (stack->frames_.size() > max_frames_) { + BPLOG(ERROR) << "The stack is over " << max_frames_ << " frames."; + break; + } // Get the next frame and take ownership. frame.reset(GetCallerFrame(stack)); @@ -166,7 +171,7 @@ Stackwalker* Stackwalker::StackwalkerForCPU( memory, modules, supplier, resolver); break; - + case MD_CONTEXT_SPARC: cpu_stackwalker = new StackwalkerSPARC(system_info, context->GetContextSPARC(), |