Summary: | Null dereference loading Blink layout test fast/loader/unload-mutation-crash.html | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Jon Honeycutt <jhoneycutt> | ||||||||
Component: | Page Loading | Assignee: | Jiewen Tan <jiewen_tan> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | aestes, bfulgham, cdumez, commit-queue, japhet, jiewen_tan, webkit-bug-importer | ||||||||
Priority: | P2 | Keywords: | BlinkMergeCandidate, HasReduction, InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Created attachment 266420 [details]
Patch
Created attachment 266423 [details]
Patch
Comment on attachment 266423 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=266423&action=review r=me, but please revise the comments as I suggested. > Source/WebCore/ChangeLog:9 > + Add an extra guard to replaceDocument() against rude JS in unload event handlers. rude! :-) > Source/WebCore/loader/DocumentWriter.cpp:76 > + // begin() might fire unload event which will result in that no new document is attached I think this should read: "// begin() might fire an unload event, which will result in a situation where no new document has been attached, // and the old document has been detached. Therefore, bail out if no document is attached." Committed r192947: <http://trac.webkit.org/changeset/192947> |
Created attachment 261441 [details] crashing test Null dereference loading Blink layout test fast/loader/unload-mutation-crash.html. Stack trace: Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008 Exception Note: EXC_CORPSE_NOTIFY VM Regions Near 0x8: --> __TEXT 0000000103d82000-0000000103d84000 [ 8K] r-x/rwx SM=COW /Users/USER/*/WebKit.framework/Versions/A/XPCServices/com.apple.WebKit.WebContent.Development.xpc/Contents/MacOS/com.apple.WebKit.WebContent.Development Application Specific Information: CRASHING TEST: temp-tests/fast/loader/unload-mutation-crash.html Global Trace Buffer (reverse chronological seconds): 48.357176 CFNetwork 0x00007fff88d43b97 Explicitly setting CF cookie storage singleton 48.357532 CFNetwork 0x00007fff88d8f211 Explicitly setting cookie storage singleton Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.apple.WebCore 0x000000010bcd7e8e WebCore::Document::recalcStyle(WebCore::Style::Change) + 46 (RefCounted.h:47) 1 com.apple.WebCore 0x000000010bcd933f WebCore::Document::createRenderTree() + 175 (Document.cpp:2192) 2 com.apple.WebCore 0x000000010bcd938b WebCore::Document::didBecomeCurrentDocumentInFrame() + 59 (Document.cpp:1710) 3 com.apple.WebCore 0x000000010be5eccc WebCore::Frame::setDocument(WTF::RefPtr<WebCore::Document>&&) + 108 (InspectorInstrumentation.h:285) 4 com.apple.WebCore 0x000000010bd1348e WebCore::DocumentWriter::begin(WebCore::URL const&, bool, WebCore::Document*) + 462 (StdLibExtras.h:366) 5 com.apple.WebCore 0x000000010bd131b3 WebCore::DocumentWriter::replaceDocument(WTF::String const&, WebCore::Document*) + 67 (RefPtr.h:71) 6 com.apple.WebCore 0x000000010c76d800 WebCore::ScriptController::executeIfJavaScriptURL(WebCore::URL const&, WebCore::ShouldReplaceDocumentIfJavaScriptURL) + 464 (RefCounted.h:99) 7 com.apple.WebCore 0x000000010c89f08f WebCore::SubframeLoader::requestFrame(WebCore::HTMLFrameOwnerElement&, WTF::String const&, WTF::AtomicString const&, WebCore::LockHistory, WebCore::LockBackForwardList) + 815 (SubframeLoader.cpp:92) 8 com.apple.WebCore 0x000000010bf2d4ab WebCore::HTMLFrameElementBase::openURL(WebCore::LockHistory, WebCore::LockBackForwardList) + 187 (HTMLFrameElementBase.cpp:91) 9 com.apple.WebCore 0x000000010bf2d7c6 WebCore::HTMLFrameElementBase::setLocation(WTF::String const&) + 166 (HTMLFrameElementBase.cpp:182) 10 com.apple.WebCore 0x000000010bf2d62e WebCore::HTMLFrameElementBase::parseAttribute(WebCore::QualifiedName const&, WTF::AtomicString const&) + 366 (StdLibExtras.h:366) 11 com.apple.WebCore 0x000000010bdb74c8 WebCore::Element::attributeChanged(WebCore::QualifiedName const&, WTF::AtomicString const&, WTF::AtomicString const&, WebCore::Element::AttributeModificationReason) + 712 (Document.h:942) 12 com.apple.WebCore 0x000000010bdbac0e WebCore::Element::didAddAttribute(WebCore::QualifiedName const&, WTF::AtomicString const&) + 46 (InspectorInstrumentation.h:285) 13 com.apple.WebCore 0x000000010bdbabcb WebCore::Element::addAttributeInternal(WebCore::QualifiedName const&, WTF::AtomicString const&, WebCore::Element::SynchronizationOfLazyAttribute) + 363 (Element.cpp:2034) 14 com.apple.WebCore 0x000000010c1dd65a WebCore::setJSHTMLIFrameElementSrc(JSC::ExecState*, JSC::JSObject*, long long, long long) + 410 (StdLibExtras.h:366) 15 com.apple.JavaScriptCore 0x000000010b3aae0c JSC::JSObject::put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&) + 1468 (CustomGetterSetter.h:52) 16 com.apple.JavaScriptCore 0x000000010b444973 llint_slow_path_put_by_id + 531 (JSCJSValueInlines.h:751) 17 com.apple.JavaScriptCore 0x000000010b451ae5 llint_entry + 11294 18 com.apple.JavaScriptCore 0x000000010b45476f llint_entry + 22696 19 com.apple.JavaScriptCore 0x000000010b44ece4 vmEntryToJavaScript + 299 20 com.apple.JavaScriptCore 0x000000010b30f2d9 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 169 (JITCode.cpp:82) 21 com.apple.JavaScriptCore 0x000000010b2f5a10 JSC::Interpreter::execute(JSC::ProgramExecutable*, JSC::ExecState*, JSC::JSObject*) + 10448 (Interpreter.cpp:945) 22 com.apple.JavaScriptCore 0x000000010b0084c5 JSC::evaluate(JSC::ExecState*, JSC::SourceCode const&, JSC::JSValue, WTF::NakedPtr<JSC::Exception>&) + 469 (Completion.cpp:104) 23 com.apple.WebCore 0x000000010c76b8ec WebCore::ScriptController::evaluateInWorld(WebCore::ScriptSourceCode const&, WebCore::DOMWrapperWorld&) + 284 (JSMainThreadExecState.h:62) 24 com.apple.WebCore 0x000000010c76d5f0 WebCore::ScriptController::executeScript(WTF::String const&, bool) + 320 (Ref.h:55) 25 com.apple.WebCore 0x000000010c76d716 WebCore::ScriptController::executeIfJavaScriptURL(WebCore::URL const&, WebCore::ShouldReplaceDocumentIfJavaScriptURL) + 230 (StdLibExtras.h:366) 26 com.apple.WebCore 0x000000010c89f08f WebCore::SubframeLoader::requestFrame(WebCore::HTMLFrameOwnerElement&, WTF::String const&, WTF::AtomicString const&, WebCore::LockHistory, WebCore::LockBackForwardList) + 815 (SubframeLoader.cpp:92) 27 com.apple.WebCore 0x000000010bf2d4ab WebCore::HTMLFrameElementBase::openURL(WebCore::LockHistory, WebCore::LockBackForwardList) + 187 (HTMLFrameElementBase.cpp:91) 28 com.apple.WebCore 0x000000010bb835ec WebCore::ContainerNode::notifyChildInserted(WebCore::Node&, WebCore::ContainerNode::ChildChangeSource) + 348 (ContainerNode.cpp:341) 29 com.apple.WebCore 0x000000010bb8309e WebCore::ContainerNode::updateTreeAfterInsertion(WebCore::Node&) + 30 (ContainerNode.cpp:826) 30 com.apple.WebCore 0x000000010bb82ead WebCore::ContainerNode::appendChild(WTF::Ref<WebCore::Node>&&, int&) + 509 (ContainerNode.cpp:691) 31 com.apple.WebCore 0x000000010c4f1688 WebCore::Node::appendChild(WTF::PassRefPtr<WebCore::Node>, int&) + 56 (Node.cpp:479) 32 com.apple.WebCore 0x000000010c2941b9 WebCore::JSNode::appendChild(JSC::ExecState*) + 73 (JSNodeCustom.cpp:149) 33 ??? 0x0000361116001028 0 + 59447011446824 34 com.apple.JavaScriptCore 0x000000010b45476f llint_entry + 22696 35 com.apple.JavaScriptCore 0x000000010b45476f llint_entry + 22696 36 com.apple.JavaScriptCore 0x000000010b44ece4 vmEntryToJavaScript + 299 37 com.apple.JavaScriptCore 0x000000010b30f2d9 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 169 (JITCode.cpp:82) 38 com.apple.JavaScriptCore 0x000000010b2f5d12 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 450 (Interpreter.cpp:1008) 39 com.apple.JavaScriptCore 0x000000010afc18b7 JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtr<JSC::Exception>&) + 71 (MarkedBlock.h:241) 40 com.apple.WebCore 0x000000010c17cfa4 WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) + 996 (JSMainThreadExecState.h:56) 41 com.apple.WebCore 0x000000010bde34db WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector<WebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow, 16ul>&) + 635 (InspectorInstrumentation.h:285) 42 com.apple.WebCore 0x000000010bde31a0 WebCore::EventTarget::fireEventListeners(WebCore::Event*) + 224 (EventTarget.cpp:208) 43 com.apple.WebCore 0x000000010bd6fbf4 WebCore::DOMWindow::dispatchEvent(WTF::PassRefPtr<WebCore::Event>, WTF::PassRefPtr<WebCore::EventTarget>) + 260 (DOMWindow.cpp:1900) 44 com.apple.WebCore 0x000000010bd7530b WebCore::DOMWindow::dispatchLoadEvent() + 347 (StdLibExtras.h:366) 45 com.apple.WebCore 0x000000010bcd8294 WebCore::Document::implicitClose() + 324 (Document.cpp:4077) 46 com.apple.WebCore 0x000000010be65003 WebCore::FrameLoader::checkCompleted() + 275 (FrameLoader.cpp:839) 47 com.apple.WebCore 0x000000010be6395b WebCore::FrameLoader::finishedParsing() + 123 (FrameLoader.cpp:760) 48 com.apple.WebCore 0x000000010bce3281 WebCore::Document::finishedParsing() + 417 (Frame.h:377) 49 com.apple.WebCore 0x000000010bf0fe05 WebCore::HTMLDocumentParser::prepareToStopParsing() + 165 (RefCounted.h:99) 50 com.apple.WebCore 0x000000010bd1369a WebCore::DocumentWriter::end() + 58 (StdLibExtras.h:366) 51 com.apple.WebCore 0x000000010bcfb9ec WebCore::DocumentLoader::finishedLoading(double) + 268 (ResourceErrorBase.h:42) 52 com.apple.WebCore 0x000000010bb2c179 WebCore::CachedResource::checkNotify() + 153 (CachedResourceClientWalker.h:51) 53 com.apple.WebCore 0x000000010bb28433 WebCore::CachedRawResource::finishLoading(WebCore::SharedBuffer*) + 227 (CachedRawResource.cpp:104) 54 com.apple.WebCore 0x000000010c8a3501 WebCore::SubresourceLoader::didFinishLoading(double) + 1153 (ResourceLoader.h:154) 55 com.apple.WebKit 0x000000010a3e998d WebKit::WebResourceLoader::didReceiveWebResourceLoaderMessage(IPC::Connection&, IPC::MessageDecoder&) + 561 (HandleMessage.h:16) 56 com.apple.WebKit 0x000000010a1c31f1 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::MessageDecoder, std::__1::default_delete<IPC::MessageDecoder> >) + 127 (memory:2636) 57 com.apple.WebKit 0x000000010a1c5b4a IPC::Connection::dispatchOneMessage() + 126 (memory:2656) 58 com.apple.JavaScriptCore 0x000000010b607b52 WTF::RunLoop::performWork() + 898 (functional:1793) 59 com.apple.JavaScriptCore 0x000000010b607d32 WTF::RunLoop::performWork(void*) + 34 (RunLoopCF.cpp:39) 60 com.apple.CoreFoundation 0x00007fff949e2c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 61 com.apple.CoreFoundation 0x00007fff949d4b1c __CFRunLoopDoSources0 + 556 62 com.apple.CoreFoundation 0x00007fff949d403f __CFRunLoopRun + 927 63 com.apple.CoreFoundation 0x00007fff949d3a38 CFRunLoopRunSpecific + 296 64 com.apple.HIToolbox 0x00007fff88e673bd RunCurrentEventLoopInMode + 235 65 com.apple.HIToolbox 0x00007fff88e67153 ReceiveNextEventCommon + 432 66 com.apple.HIToolbox 0x00007fff88e66f93 _BlockUntilNextEventMatchingListInModeWithFilter + 71 67 com.apple.AppKit 0x00007fff870b81e7 _DPSNextEvent + 1076 68 com.apple.AppKit 0x00007fff8748490d -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454 69 com.apple.AppKit 0x00007fff870ae0b8 -[NSApplication run] + 682 70 com.apple.AppKit 0x00007fff87030396 NSApplicationMain + 1176 71 libxpc.dylib 0x00007fff8c70ff70 _xpc_objc_main + 793 72 libxpc.dylib 0x00007fff8c7116bf xpc_main + 494 73 com.apple.WebKit.WebContent.Development 0x0000000103d83424 main + 409 (XPCServiceMain.Development.mm:187) 74 libdyld.dylib 0x00007fff93aa15ad start + 1