Ignore:
Timestamp:
Jan 1, 2009, 12:22:40 AM (16 years ago)
Author:
[email protected]
Message:

[jsfunfuzz] Assertion + incorrect behaviour with dynamically created local variable in a catch block
<https://bugs.webkit.org/show_bug.cgi?id=23063>

Reviewed by Cameron Zwarich

Eval inside a catch block attempts to use the catch block's static scope in
an unsafe way by attempting to add new properties to the scope. This patch
fixes this issue simply by preventing the catch block from using a static
scope if it contains an eval.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Nodes.cpp

    r39533 r39534  
    23322332        generator.emitJump(handlerEndLabel.get());
    23332333        RefPtr<RegisterID> exceptionRegister = generator.emitCatch(generator.newTemporary(), tryStartLabel.get(), tryEndLabel.get());
    2334         generator.emitPushNewScope(exceptionRegister.get(), m_exceptionIdent, exceptionRegister.get());
     2334        if (m_catchHasEval) {
     2335            RefPtr<RegisterID> dynamicScopeObject = generator.emitNewObject(generator.newTemporary());
     2336            generator.emitPutById(dynamicScopeObject.get(), m_exceptionIdent, exceptionRegister.get());
     2337            generator.emitMove(exceptionRegister.get(), dynamicScopeObject.get());
     2338            generator.emitPushScope(exceptionRegister.get());
     2339        } else
     2340            generator.emitPushNewScope(exceptionRegister.get(), m_exceptionIdent, exceptionRegister.get());
    23352341        generator.emitNode(dst, m_catchBlock.get());
    23362342        generator.emitPopScope();
Note: See TracChangeset for help on using the changeset viewer.