Changeset 282241 in webkit
- Timestamp:
- Sep 9, 2021, 3:24:42 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
loader/cache/CachedRawResource.cpp (modified) (1 diff)
-
platform/SharedBuffer.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r282237 r282241 1 2021-09-09 Chris Dumez <cdumez@apple.com> 2 3 Potential crash under CachedRawResource::didAddClient() 4 https://bugs.webkit.org/show_bug.cgi?id=230121 5 <rdar://82936913> 6 7 Reviewed by Alex Christensen. 8 9 In r280083, I tried to address this crash by holding a strong reference 10 to the SharedBuffer before calling forEachSegment() on it. However, the 11 crash is still happening after this fix. 12 13 My suspicion is that the SharedBuffer's internal m_segments vector gets 14 modified as we iterate over it. As a result, I am reverting r280083 and 15 iterating over a copy of m_segments in forEachSegment() instead. 16 17 No new tests, we haven't been able to reproduce. 18 19 * WebCore.xcodeproj/project.pbxproj: 20 * loader/cache/CachedRawResource.cpp: 21 (WebCore::CachedRawResource::didAddClient): 22 * platform/SharedBuffer.cpp: 23 (WebCore::SharedBuffer::forEachSegment const): 24 1 25 2021-09-09 Fujii Hironori <Hironori.Fujii@sony.com> 2 26 -
trunk/Source/WebCore/loader/cache/CachedRawResource.cpp
r280083 r282241 168 168 if (!hasClient(*client)) 169 169 return; 170 if ( auto data =m_data) {171 data->forEachSegment([&](auto& segment) {170 if (m_data) { 171 m_data->forEachSegment([&](auto& segment) { 172 172 if (hasClient(*client)) 173 173 client->dataReceived(*this, segment.data(), segment.size()); -
trunk/Source/WebCore/platform/SharedBuffer.cpp
r280260 r282241 239 239 void SharedBuffer::forEachSegment(const Function<void(const Span<const uint8_t>&)>& apply) const 240 240 { 241 for (auto& segment : m_segments) 241 auto segments = m_segments; 242 for (auto& segment : segments) 242 243 apply(Span { segment.segment->data(), segment.segment->size() }); 243 244 }
Note:
See TracChangeset
for help on using the changeset viewer.