Ignore:
Timestamp:
Oct 26, 2017, 3:36:04 PM (8 years ago)
Author:
[email protected]
Message:

JSRopeString::RopeBuilder::append() should check for overflows.
https://bugs.webkit.org/show_bug.cgi?id=178385
<rdar://problem/35027468>

Reviewed by Saam Barati.

JSTests:

  • stress/regress-178385.js: Added.

Source/JavaScriptCore:

  1. Made RopeString check for overflow like the Checked class does.
  2. Added a missing overflow check in objectProtoFuncToString().
  • runtime/JSString.cpp:

(JSC::JSRopeString::RopeBuilder<RecordOverflow>::expand):
(JSC::JSRopeString::RopeBuilder::expand): Deleted.

  • runtime/JSString.h:
  • runtime/ObjectPrototype.cpp:

(JSC::objectProtoFuncToString):

  • runtime/Operations.h:

(JSC::jsStringFromRegisterArray):
(JSC::jsStringFromArguments):

Source/WTF:

  • wtf/CheckedArithmetic.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSString.cpp

    r222473 r224055  
    4141}
    4242
    43 void JSRopeString::RopeBuilder::expand()
    44 {
     43template<>
     44void JSRopeString::RopeBuilder<RecordOverflow>::expand()
     45{
     46    RELEASE_ASSERT(!this->hasOverflowed());
    4547    ASSERT(m_index == JSRopeString::s_maxInternalRopeLength);
    4648    JSString* jsString = m_jsString;
    47     RELEASE_ASSERT(jsString);
    4849    m_jsString = jsStringBuilder(&m_vm);
    4950    m_index = 0;
Note: See TracChangeset for help on using the changeset viewer.