Changeset 228975 in webkit
- Timestamp:
- Feb 24, 2018 2:06:39 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r228974 r228975 1 2018-02-24 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 Null-dereference of the second argument `resource` of DocumentLoader::scheduleSubstituteResourceLoad 4 https://bugs.webkit.org/show_bug.cgi?id=182920 5 6 Reviewed by Darin Adler. 7 8 A test case 9 imported/w3c/web-platform-tests/html/browsers/offline/appcache/workers/appcache-worker.html 10 always crashes due to a null-dereference if compiled and optimized 11 by GCC 7.2. The second argument `resource` of 12 DocumentLoader::scheduleSubstituteResourceLoad can be null if the 13 resource can't be found in cache. I guess GCC optimizes inline 14 HashMap::add based on assuming the `resource` never becomes null 15 because its type is SubstituteResource&. 16 17 This changes introduces a new method 18 DocumentLoader::scheduleCannotShowURLError because it looks tricky 19 to pass a nullptr to the second argument of 20 scheduleSubstituteResourceLoad. 21 22 No new tests (Covered by existing tests). 23 24 * loader/DocumentLoader.cpp: 25 (WebCore::DocumentLoader::scheduleCannotShowURLError): Added a new method. 26 * loader/DocumentLoader.h: 27 * loader/appcache/ApplicationCacheHost.cpp: 28 (WebCore::ApplicationCacheHost::maybeLoadResource): 29 Call scheduleCannotShowURLError if the resource not found in the appcache. 30 1 31 2018-02-17 Darin Adler <darin@apple.com> 2 32 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r228892 r228975 1438 1438 } 1439 1439 1440 void DocumentLoader::scheduleCannotShowURLError(ResourceLoader& loader) 1441 { 1442 m_pendingSubstituteResources.set(&loader, nullptr); 1443 deliverSubstituteResourcesAfterDelay(); 1444 } 1445 1440 1446 void DocumentLoader::addResponse(const ResourceResponse& response) 1441 1447 { -
trunk/Source/WebCore/loader/DocumentLoader.h
r227348 r228975 185 185 186 186 void scheduleSubstituteResourceLoad(ResourceLoader&, SubstituteResource&); 187 void scheduleCannotShowURLError(ResourceLoader&); 187 188 188 189 // Return the ArchiveResource for the URL only when loading an Archive -
trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp
r228892 r228975 183 183 return false; 184 184 185 m_documentLoader.scheduleSubstituteResourceLoad(loader, *resource); 185 if (resource) 186 m_documentLoader.scheduleSubstituteResourceLoad(loader, *resource); 187 else 188 m_documentLoader.scheduleCannotShowURLError(loader); 186 189 return true; 187 190 }
Note: See TracChangeset
for help on using the changeset viewer.