Changeset 158875 in webkit


Ignore:
Timestamp:
Nov 7, 2013 2:19:58 PM (10 years ago)
Author:
oliver@apple.com
Message:

Reproducible crash when using Map (affects Web Inspector)
https://bugs.webkit.org/show_bug.cgi?id=123940

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Trivial fix. Once again we get bitten by attempting to be clever when
growing while adding entries to indexing maps.

Now we simply do a find(), and then add() _after_ we've ensured there is
sufficient space in the MapData list.

  • runtime/MapData.cpp:

(JSC::MapData::add):

LayoutTests:

Add testcases

  • js/map-grow-with-holes-expected.txt: Added.
  • js/map-grow-with-holes.html: Added.
  • js/script-tests/map-grow-with-holes.js: Added.

(get map):

Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r158871 r158875  
     12013-11-07  Oliver Hunt  <oliver@apple.com>
     2
     3        Reproducible crash when using Map (affects Web Inspector)
     4        https://bugs.webkit.org/show_bug.cgi?id=123940
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Add testcases
     9
     10        * js/map-grow-with-holes-expected.txt: Added.
     11        * js/map-grow-with-holes.html: Added.
     12        * js/script-tests/map-grow-with-holes.js: Added.
     13        (get map):
     14
    1152013-11-07  Michał Pakuła vel Rutka  <m.pakula@samsung.com>
    216
  • trunk/Source/JavaScriptCore/ChangeLog

    r158862 r158875  
     12013-11-07  Oliver Hunt  <oliver@apple.com>
     2
     3        Reproducible crash when using Map (affects Web Inspector)
     4        https://bugs.webkit.org/show_bug.cgi?id=123940
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Trivial fix.  Once again we get bitten by attempting to be clever when
     9        growing while adding entries to indexing maps.
     10
     11        Now we simply do a find(), and then add() _after_ we've ensured there is
     12        sufficient space in the MapData list.
     13
     14        * runtime/MapData.cpp:
     15        (JSC::MapData::add):
     16
    1172013-11-07  Mark Lam  <mark.lam@apple.com>
    218
  • trunk/Source/JavaScriptCore/runtime/MapData.cpp

    r155560 r158875  
    8181template <typename Map, typename Key> MapData::Entry* MapData::add(CallFrame* callFrame, Map& map, Key key, KeyType keyValue)
    8282{
    83     typename Map::AddResult result = map.add(key, m_size);
    84     if (!result.isNewEntry)
    85         return &m_entries[result.iterator->value];
    86     if (!ensureSpaceForAppend(callFrame)) {
    87         map.remove(result.iterator);
     83    typename Map::iterator location = map.find(key);
     84    if (location != map.end())
     85        return &m_entries[location->value];
     86   
     87    if (!ensureSpaceForAppend(callFrame))
    8888        return 0;
    89     }
    90 
     89
     90    auto result = map.add(key, m_size);
     91    RELEASE_ASSERT(result.isNewEntry);
    9192    Entry* entry = &m_entries[m_size++];
    9293    new (entry) Entry();
Note: See TracChangeset for help on using the changeset viewer.