mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-01-23 13:11:03 +00:00
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
This commit is contained in:
parent
64506d2ed7
commit
8e77c078d6
|
@ -48,7 +48,6 @@
|
||||||
namespace google_breakpad {
|
namespace google_breakpad {
|
||||||
|
|
||||||
class CallStack;
|
class CallStack;
|
||||||
class CodeModule;
|
|
||||||
class CodeModules;
|
class CodeModules;
|
||||||
class MemoryRegion;
|
class MemoryRegion;
|
||||||
class MinidumpContext;
|
class MinidumpContext;
|
||||||
|
@ -80,6 +79,9 @@ class Stackwalker {
|
||||||
SymbolSupplier *supplier,
|
SymbolSupplier *supplier,
|
||||||
SourceLineResolverInterface *resolver);
|
SourceLineResolverInterface *resolver);
|
||||||
|
|
||||||
|
static void set_max_frames(u_int32_t max_frames) { max_frames_ = max_frames; }
|
||||||
|
static u_int32_t max_frames() { return max_frames_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// system_info identifies the operating system, NULL or empty if unknown.
|
// system_info identifies the operating system, NULL or empty if unknown.
|
||||||
// memory identifies a MemoryRegion that provides the stack memory
|
// memory identifies a MemoryRegion that provides the stack memory
|
||||||
|
@ -146,6 +148,10 @@ class Stackwalker {
|
||||||
// this in order to avoid repeatedly looking them up again within
|
// this in order to avoid repeatedly looking them up again within
|
||||||
// one minidump.
|
// one minidump.
|
||||||
set<std::string> no_symbol_modules_;
|
set<std::string> no_symbol_modules_;
|
||||||
|
|
||||||
|
// The maximum number of frames Stackwalker will walk through.
|
||||||
|
// This defaults to 1024 to prevent infinite loops.
|
||||||
|
static u_int32_t max_frames_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
|
|
||||||
namespace google_breakpad {
|
namespace google_breakpad {
|
||||||
|
|
||||||
|
u_int32_t Stackwalker::max_frames_ = 1024;
|
||||||
|
|
||||||
Stackwalker::Stackwalker(const SystemInfo *system_info,
|
Stackwalker::Stackwalker(const SystemInfo *system_info,
|
||||||
MemoryRegion *memory,
|
MemoryRegion *memory,
|
||||||
|
@ -120,6 +121,10 @@ bool Stackwalker::Walk(CallStack *stack) {
|
||||||
// Add the frame to the call stack. Relinquish the ownership claim
|
// Add the frame to the call stack. Relinquish the ownership claim
|
||||||
// over the frame, because the stack now owns it.
|
// over the frame, because the stack now owns it.
|
||||||
stack->frames_.push_back(frame.release());
|
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.
|
// Get the next frame and take ownership.
|
||||||
frame.reset(GetCallerFrame(stack));
|
frame.reset(GetCallerFrame(stack));
|
||||||
|
@ -166,7 +171,7 @@ Stackwalker* Stackwalker::StackwalkerForCPU(
|
||||||
memory, modules, supplier,
|
memory, modules, supplier,
|
||||||
resolver);
|
resolver);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MD_CONTEXT_SPARC:
|
case MD_CONTEXT_SPARC:
|
||||||
cpu_stackwalker = new StackwalkerSPARC(system_info,
|
cpu_stackwalker = new StackwalkerSPARC(system_info,
|
||||||
context->GetContextSPARC(),
|
context->GetContextSPARC(),
|
||||||
|
|
Loading…
Reference in a new issue