Ignore:
Timestamp:
Jul 2, 2010, 9:52:45 PM (15 years ago)
Author:
[email protected]
Message:

Clamp the number of arguments supported by function.apply
https://bugs.webkit.org/show_bug.cgi?id=41351
<rdar://problem/8142141>

Reviewed by Gavin Barraclough.

JavaScriptCore:

Add clamping logic to function.apply similar to that
enforced by firefox. We have a smaller clamp than
firefox as our calling convention means that stack
usage is proportional to argument count -- the firefox
limit is larger than you could actually call.

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/Arguments.h:

(JSC::Arguments::):

LayoutTests:

Testcases.

  • fast/js/function-apply-many-args-expected.txt: Added.
  • fast/js/function-apply-many-args.html: Added.
  • fast/js/script-tests/function-apply-many-args.js: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSArray.cpp

    r60762 r62432  
    949949void JSArray::copyToRegisters(ExecState* exec, Register* buffer, uint32_t maxSize)
    950950{
    951     ASSERT(m_storage->m_length == maxSize);
     951    ASSERT(m_storage->m_length >= maxSize);
    952952    UNUSED_PARAM(maxSize);
    953953    JSValue* vector = m_storage->m_vector;
    954     unsigned vectorEnd = min(m_storage->m_length, m_vectorLength);
     954    unsigned vectorEnd = min(maxSize, m_vectorLength);
    955955    unsigned i = 0;
    956956    for (; i < vectorEnd; ++i) {
     
    961961    }
    962962
    963     for (; i < m_storage->m_length; ++i)
     963    for (; i < maxSize; ++i)
    964964        buffer[i] = get(exec, i);
    965965}
Note: See TracChangeset for help on using the changeset viewer.