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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 # HG changeset patch
     2 # User Julian Seward <jseward@acm.org>
     3 # Date 1366643454 -7200
     4 #      Mon Apr 22 17:10:54 2013 +0200
     5 # Node ID 3e64f12d9dab619c90bee02ed071bcda0100844e
     6 # Parent  6d06a09b3f5624dd833bd6f905bfd88e3fdec00a
     7 Bug 859745 - Install sane unwinding limit for SPS/breakpad.  r=ted
     9 diff --git a/src/google_breakpad/processor/stackwalker.h b/src/google_breakpad/processor/stackwalker.h
    10 --- a/src/google_breakpad/processor/stackwalker.h
    11 +++ b/src/google_breakpad/processor/stackwalker.h
    12 @@ -83,17 +83,20 @@ class Stackwalker {
    13    // argument.  If no suitable concrete subclass exists, returns NULL.
    14    static Stackwalker* StackwalkerForCPU(
    15       const SystemInfo* system_info,
    16       MinidumpContext* context,
    17       MemoryRegion* memory,
    18       const CodeModules* modules,
    19       StackFrameSymbolizer* resolver_helper);
    21 -  static void set_max_frames(uint32_t max_frames) { max_frames_ = max_frames; }
    22 +  static void set_max_frames(uint32_t max_frames) {
    23 +    max_frames_ = max_frames;
    24 +    max_frames_set_ = true;
    25 +  }
    26    static uint32_t max_frames() { return max_frames_; }
    28   protected:
    29    // system_info identifies the operating system, NULL or empty if unknown.
    30    // memory identifies a MemoryRegion that provides the stack memory
    31    // for the stack to walk.  modules, if non-NULL, is a CodeModules
    32    // object that is used to look up which code module each stack frame is
    33    // associated with.  frame_symbolizer is a StackFrameSymbolizer object that
    34 @@ -191,14 +194,19 @@ class Stackwalker {
    35    // the end of the stack has been reached).  GetCallerFrame allocates a new
    36    // StackFrame (or StackFrame subclass), ownership of which is taken by
    37    // the caller.
    38    virtual StackFrame* GetCallerFrame(const CallStack* stack) = 0;
    40    // The maximum number of frames Stackwalker will walk through.
    41    // This defaults to 1024 to prevent infinite loops.
    42    static uint32_t max_frames_;
    43 +
    44 +  // Keep track of whether max_frames_ has been set by the user, since
    45 +  // it affects whether or not an error message is printed in the case
    46 +  // where an unwind got stopped by the limit.
    47 +  static bool max_frames_set_;
    48  };
    50  }  // namespace google_breakpad
    53  #endif  // GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__
    54 diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc
    55 --- a/src/processor/stackwalker.cc
    56 +++ b/src/processor/stackwalker.cc
    57 @@ -52,16 +52,17 @@
    58  #include "processor/stackwalker_x86.h"
    59  #include "processor/stackwalker_amd64.h"
    60  #include "processor/stackwalker_arm.h"
    62  namespace google_breakpad {
    64  const int Stackwalker::kRASearchWords = 30;
    65  uint32_t Stackwalker::max_frames_ = 1024;
    66 +bool Stackwalker::max_frames_set_ = false;
    68  Stackwalker::Stackwalker(const SystemInfo* system_info,
    69                           MemoryRegion* memory,
    70                           const CodeModules* modules,
    71                           StackFrameSymbolizer* frame_symbolizer)
    72      : system_info_(system_info),
    73        memory_(memory),
    74        modules_(modules),
    75 @@ -120,17 +121,20 @@ bool Stackwalker::Walk(CallStack* stack,
    76          modules_without_symbols->push_back(frame->module);
    77        }
    78      }
    80      // Add the frame to the call stack.  Relinquish the ownership claim
    81      // over the frame, because the stack now owns it.
    82      stack->frames_.push_back(frame.release());
    83      if (stack->frames_.size() > max_frames_) {
    84 -      BPLOG(ERROR) << "The stack is over " << max_frames_ << " frames.";
    85 +      // Only emit an error message in the case where the limit that we
    86 +      // reached is the default limit, not set by the user.
    87 +      if (!max_frames_set_)
    88 +        BPLOG(ERROR) << "The stack is over " << max_frames_ << " frames.";
    89        break;
    90      }
    92      // Get the next frame and take ownership.
    93      frame.reset(GetCallerFrame(stack));
    94    }
    96    return true;

mercurial