toolkit/crashreporter/breakpad-patches/15-bug859745.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/crashreporter/breakpad-patches/15-bug859745.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,96 @@
     1.4 +# HG changeset patch
     1.5 +# User Julian Seward <jseward@acm.org>
     1.6 +# Date 1366643454 -7200
     1.7 +#      Mon Apr 22 17:10:54 2013 +0200
     1.8 +# Node ID 3e64f12d9dab619c90bee02ed071bcda0100844e
     1.9 +# Parent  6d06a09b3f5624dd833bd6f905bfd88e3fdec00a
    1.10 +Bug 859745 - Install sane unwinding limit for SPS/breakpad.  r=ted
    1.11 +
    1.12 +diff --git a/src/google_breakpad/processor/stackwalker.h b/src/google_breakpad/processor/stackwalker.h
    1.13 +--- a/src/google_breakpad/processor/stackwalker.h
    1.14 ++++ b/src/google_breakpad/processor/stackwalker.h
    1.15 +@@ -83,17 +83,20 @@ class Stackwalker {
    1.16 +   // argument.  If no suitable concrete subclass exists, returns NULL.
    1.17 +   static Stackwalker* StackwalkerForCPU(
    1.18 +      const SystemInfo* system_info,
    1.19 +      MinidumpContext* context,
    1.20 +      MemoryRegion* memory,
    1.21 +      const CodeModules* modules,
    1.22 +      StackFrameSymbolizer* resolver_helper);
    1.23 + 
    1.24 +-  static void set_max_frames(uint32_t max_frames) { max_frames_ = max_frames; }
    1.25 ++  static void set_max_frames(uint32_t max_frames) {
    1.26 ++    max_frames_ = max_frames;
    1.27 ++    max_frames_set_ = true;
    1.28 ++  }
    1.29 +   static uint32_t max_frames() { return max_frames_; }
    1.30 + 
    1.31 +  protected:
    1.32 +   // system_info identifies the operating system, NULL or empty if unknown.
    1.33 +   // memory identifies a MemoryRegion that provides the stack memory
    1.34 +   // for the stack to walk.  modules, if non-NULL, is a CodeModules
    1.35 +   // object that is used to look up which code module each stack frame is
    1.36 +   // associated with.  frame_symbolizer is a StackFrameSymbolizer object that
    1.37 +@@ -191,14 +194,19 @@ class Stackwalker {
    1.38 +   // the end of the stack has been reached).  GetCallerFrame allocates a new
    1.39 +   // StackFrame (or StackFrame subclass), ownership of which is taken by
    1.40 +   // the caller.
    1.41 +   virtual StackFrame* GetCallerFrame(const CallStack* stack) = 0;
    1.42 + 
    1.43 +   // The maximum number of frames Stackwalker will walk through.
    1.44 +   // This defaults to 1024 to prevent infinite loops.
    1.45 +   static uint32_t max_frames_;
    1.46 ++
    1.47 ++  // Keep track of whether max_frames_ has been set by the user, since
    1.48 ++  // it affects whether or not an error message is printed in the case
    1.49 ++  // where an unwind got stopped by the limit.
    1.50 ++  static bool max_frames_set_;
    1.51 + };
    1.52 + 
    1.53 + }  // namespace google_breakpad
    1.54 + 
    1.55 + 
    1.56 + #endif  // GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__
    1.57 +diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc
    1.58 +--- a/src/processor/stackwalker.cc
    1.59 ++++ b/src/processor/stackwalker.cc
    1.60 +@@ -52,16 +52,17 @@
    1.61 + #include "processor/stackwalker_x86.h"
    1.62 + #include "processor/stackwalker_amd64.h"
    1.63 + #include "processor/stackwalker_arm.h"
    1.64 + 
    1.65 + namespace google_breakpad {
    1.66 + 
    1.67 + const int Stackwalker::kRASearchWords = 30;
    1.68 + uint32_t Stackwalker::max_frames_ = 1024;
    1.69 ++bool Stackwalker::max_frames_set_ = false;
    1.70 + 
    1.71 + Stackwalker::Stackwalker(const SystemInfo* system_info,
    1.72 +                          MemoryRegion* memory,
    1.73 +                          const CodeModules* modules,
    1.74 +                          StackFrameSymbolizer* frame_symbolizer)
    1.75 +     : system_info_(system_info),
    1.76 +       memory_(memory),
    1.77 +       modules_(modules),
    1.78 +@@ -120,17 +121,20 @@ bool Stackwalker::Walk(CallStack* stack,
    1.79 +         modules_without_symbols->push_back(frame->module);
    1.80 +       }
    1.81 +     }
    1.82 + 
    1.83 +     // Add the frame to the call stack.  Relinquish the ownership claim
    1.84 +     // over the frame, because the stack now owns it.
    1.85 +     stack->frames_.push_back(frame.release());
    1.86 +     if (stack->frames_.size() > max_frames_) {
    1.87 +-      BPLOG(ERROR) << "The stack is over " << max_frames_ << " frames.";
    1.88 ++      // Only emit an error message in the case where the limit that we
    1.89 ++      // reached is the default limit, not set by the user.
    1.90 ++      if (!max_frames_set_)
    1.91 ++        BPLOG(ERROR) << "The stack is over " << max_frames_ << " frames.";
    1.92 +       break;
    1.93 +     }
    1.94 + 
    1.95 +     // Get the next frame and take ownership.
    1.96 +     frame.reset(GetCallerFrame(stack));
    1.97 +   }
    1.98 + 
    1.99 +   return true;

mercurial