Changeset 34092 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
May 23, 2008, 4:07:19 PM (17 years ago)
Author:
[email protected]
Message:

2008-05-23 Kevin McCullough <[email protected]>

Reviewed by Sam.

<rdar://problem/5960012> JSProfiler: Stack overflow if recursion is
too deep.
-Use a simple depth limit to restrict too deep of recursion.

  • profiler/Profile.cpp: (KJS::Profile::willExecute): (KJS::Profile::didExecute):
  • profiler/Profile.h:
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r34091 r34092  
     12008-05-23  Kevin McCullough  <[email protected]>
     2
     3        Reviewed by Sam.
     4
     5        <rdar://problem/5960012> JSProfiler: Stack overflow if recursion is
     6        too deep.
     7        -Use a simple depth limit to restrict too deep of recursion.
     8
     9        * profiler/Profile.cpp:
     10        (KJS::Profile::willExecute):
     11        (KJS::Profile::didExecute):
     12        * profiler/Profile.h:
     13
    1142008-05-23  Geoffrey Garen  <[email protected]>
    215
  • trunk/JavaScriptCore/profiler/Profile.cpp

    r34090 r34092  
    3636namespace KJS {
    3737
     38const unsigned DEPTH_LIMIT = 1000;
     39
    3840Profile::Profile(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier)
    3941    : m_title(title)
    4042    , m_originatingGlobalExec(originatingGlobalExec)
    4143    , m_pageGroupIdentifier(pageGroupIdentifier)
     44    , m_depth(0)
    4245{
    4346    // FIXME: When multi-threading is supported this will be a vector and calls
     
    5255    m_originatingGlobalExec = 0;
    5356    m_headNode->stopProfiling();
     57    m_depth = 0;
    5458}
    5559
    5660void Profile::willExecute(const CallIdentifier& callIdentifier)
    5761{
     62    if (++m_depth >= DEPTH_LIMIT)
     63        return;
     64       
    5865    ASSERT(m_currentNode);
    5966    m_currentNode = m_currentNode->willExecute(callIdentifier);
     
    7784
    7885    m_currentNode = m_currentNode->didExecute();
     86    --m_depth;
    7987}
    8088
  • trunk/JavaScriptCore/profiler/Profile.h

    r34051 r34092  
    7979        RefPtr<ProfileNode> m_headNode;
    8080        RefPtr<ProfileNode> m_currentNode;
     81       
     82        unsigned m_depth;
    8183    };
    8284
Note: See TracChangeset for help on using the changeset viewer.