Changeset 246024 in webkit
- Timestamp:
- Jun 2, 2019, 3:18:06 PM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
runtime/StructureIDTable.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r246022 r246024 1 2019-06-02 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Crash explicitly if StructureIDs are exhausted 4 https://bugs.webkit.org/show_bug.cgi?id=198467 5 6 Reviewed by Sam Weinig. 7 8 When StructureIDTable::m_size reaches to s_maximumNumberOfStructures, newCapacity in resize function is also capped with s_maximumNumberOfStructures. 9 So m_size == newCapacity. In that case, the following code in resize function, `makeFreeListFromRange(m_size, m_capacity - 1);` starts executing the 10 wrong code. 11 12 Currently, this is safe. We immediately execute the wrong code in makeFreeListFromRange, and crash with zero division. But we should not rely on 13 this crash, and instead we should explicitly crash because we exhaust StructureIDs. 14 15 This patch inserts RELEASE_ASSERT for `m_size < newCapacity` status to ensure that resize is always extending the table. 16 17 In practice, this crash does not happen in Safari because Safari has memory footprint limit. To exhaust StructureIDs, we need to allocate massive 18 amount of Structures, and it exceeds the memory footprint limit and the process will be killed. 19 20 * runtime/StructureIDTable.cpp: 21 (JSC::StructureIDTable::resize): 22 1 23 2019-06-02 Keith Miller <keith_miller@apple.com> 2 24 -
trunk/Source/JavaScriptCore/runtime/StructureIDTable.cpp
r242103 r246024 103 103 newCapacity = s_maximumNumberOfStructures; 104 104 105 // If m_size is already s_maximumNumberOfStructures, newCapacity becomes s_maximumNumberOfStructures in the above code. 106 // In that case, we should crash because of exhaust of StructureIDs. 107 RELEASE_ASSERT_WITH_MESSAGE(m_size < newCapacity, "Crash intentionally because of exhaust of StructureIDs."); 108 105 109 // Create the new table. 106 110 auto newTable = makeUniqueArray<StructureOrOffset>(newCapacity);
Note:
See TracChangeset
for help on using the changeset viewer.