Changeset 39660 in webkit


Ignore:
Timestamp:
Jan 6, 2009 12:33:54 PM (15 years ago)
Author:
oliver@apple.com
Message:

<https://bugs.webkit.org/show_bug.cgi?id=23085> [jsfunfuzz] Over released ScopeChainNode
<rdar://problem/6474110>

Reviewed by Cameron Zwarich

So this delightful bug was caused by our unwind code using a ScopeChain to perform
the unwind. The ScopeChain would ref the initial top of the scope chain, then deref
the resultant top of scope chain, which is incorrect.

This patch removes the dependency on ScopeChain for the unwind, and i've filed
<https://bugs.webkit.org/show_bug.cgi?id=23144> to look into the unintuitive
ScopeChain behaviour.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r39658 r39660  
     12009-01-06  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Cameron Zwarich.
     4
     5        <https://bugs.webkit.org/show_bug.cgi?id=23085> [jsfunfuzz] Over released ScopeChainNode
     6        <rdar://problem/6474110>
     7
     8        So this delightful bug was caused by our unwind code using a ScopeChain to perform
     9        the unwind.  The ScopeChain would ref the initial top of the scope chain, then deref
     10        the resultant top of scope chain, which is incorrect.
     11
     12        This patch removes the dependency on ScopeChain for the unwind, and i've filed
     13        <https://bugs.webkit.org/show_bug.cgi?id=23144> to look into the unintuitive
     14        ScopeChain behaviour.
     15
     16        * interpreter/Interpreter.cpp:
     17        (JSC::Interpreter::throwException):
     18
    1192009-01-06  Adam Roben  <aroben@apple.com>
    220
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r39631 r39660  
    851851    // Now unwind the scope chain within the exception handler's call frame.
    852852
    853     ScopeChain sc(callFrame->scopeChain());
     853    ScopeChainNode* scopeChain = callFrame->scopeChain();
     854    ScopeChain sc(scopeChain);
    854855    int scopeDelta = depth(codeBlock, sc) - handler->scopeDepth;
    855856    ASSERT(scopeDelta >= 0);
    856857    while (scopeDelta--)
    857         sc.pop();
    858     callFrame->setScopeChain(sc.node());
     858        scopeChain = scopeChain->pop();
     859    callFrame->setScopeChain(scopeChain);
    859860
    860861    return handler;
  • trunk/LayoutTests/ChangeLog

    r39634 r39660  
     12009-01-06  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Cameron Zwarich.
     4
     5        <https://bugs.webkit.org/show_bug.cgi?id=23085> [jsfunfuzz] Over released ScopeChainNode
     6        <rdar://problem/6474110>
     7
     8        Add test for over releasing the scopechain.
     9
     10        * fast/js/exception-try-finally-scope-error-expected.txt:
     11        * fast/js/resources/exception-try-finally-scope-error.js:
     12
    1132008-01-05  Dean Jackson  <dino@apple.com>
    214
  • trunk/LayoutTests/fast/js/exception-try-finally-scope-error-expected.txt

    r35812 r39660  
    1 This test makes sure stack unwinding works correctly when confronted with a 0-depth scope chain without an activation
     1This test makes sure stack unwinding works correctly in combination with dynamically added scopes
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
  • trunk/LayoutTests/fast/js/resources/exception-try-finally-scope-error.js

    r35812 r39660  
    1 description('This test makes sure stack unwinding works correctly when confronted with a 0-depth scope chain without an activation');
     1description('This test makes sure stack unwinding works correctly in combination with dynamically added scopes');
     2
     3function gc()
     4{
     5    if (this.GCController)
     6        GCController.collect();
     7    else
     8        for (var i = 0; i < 10000; ++i) // Allocate a sufficient number of objects to force a GC.
     9            ({});
     10}
     11
    212var result;
    313function runTest() {
     
    818runTest();
    919
     20try{
     21(function() {
     22    try {
     23        throw "";
     24    } catch(y) {
     25        throw (function(){});
     26    } finally {
     27    }
     28})()
     29}catch(r){
     30}
     31
     32// Just clobber any temporaries
     33a=({});
     34a*=a*a*a;
     35
     36gc();
     37
    1038var successfullyParsed = true;
Note: See TracChangeset for help on using the changeset viewer.