Ignore:
Timestamp:
Sep 19, 2007, 3:07:19 AM (18 years ago)
Author:
bdash
Message:

2007-09-19 Mark Rowe <[email protected]>

Reviewed by Maciej.

<rdar://problem/5487107> NULL dereference crash in FastMallocZone::enumerate when running leaks against Safari

Storing remote pointers to their local equivalents in mapped memory was leading to the local pointer being
interpreted as a remote pointer. This caused a crash when using the result of mapping this invalid remote pointer.
The fix is to follow the pattern used elsewhere in FastMallocZone by always doing the mapping after reading and
never storing the mapped pointer.

  • wtf/FastMalloc.cpp: (WTF::FastMallocZone::enumerate):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/FastMalloc.cpp

    r25483 r25637  
    24762476    void findFreeObjects(TCMalloc_ThreadCache* threadCache)
    24772477    {
    2478         for (; threadCache; threadCache = threadCache->next_)
     2478        for (; threadCache; threadCache = (threadCache->next_ ? m_reader(threadCache->next_) : 0))
    24792479            threadCache->enumerateFreeObjects(*this, m_reader);
    24802480    }
     
    25942594
    25952595    TCMalloc_Central_FreeListPadded* centralCaches = memoryReader(mzone->m_centralCaches, sizeof(TCMalloc_Central_FreeListPadded) * kNumClasses);
    2596 
    2597     // Rebuild the linked list in our address space, mapping over the remote pointers as needed
    2598     for (TCMalloc_ThreadCache* threadHeap = threadHeaps; threadHeap->next_; threadHeap = threadHeap->next_) {
    2599         threadHeap->next_ = memoryReader(threadHeap->next_);
    2600         threadHeap->next_->prev_ = threadHeap;
    2601     }
    26022596
    26032597    FreeObjectFinder finder(memoryReader);
Note: See TracChangeset for help on using the changeset viewer.