Bug 149288

Summary: Null dereference loading Blink layout test editing/execCommand/crash-replacing-list-by-list.html
Product: WebKit Reporter: Jon Honeycutt <jhoneycutt>
Component: HTML EditingAssignee: Jiewen Tan <jiewen_tan>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, jiewen_tan, webkit-bug-importer
Priority: P2 Keywords: BlinkMergeCandidate, HasReduction, InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
crashing test
none
Patch
none
Patch none

Description Jon Honeycutt 2015-09-17 14:26:46 PDT
Created attachment 261422 [details]
crashing test

Null dereference loading Blink layout test editing/execCommand/crash-replacing-list-by-list.html.

Stack trace:

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000015
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0x15:
--> 
    __TEXT                 00000001003e4000-00000001003e6000 [    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/editing/execCommand/crash-replacing-list-by-list.html

Global Trace Buffer (reverse chronological seconds):
18446744062.062584 CFNetwork                 	0x00007fff88d43b97 Explicitly setting CF cookie storage singleton
18446744062.062977 CFNetwork                 	0x00007fff88d8f211 Explicitly setting cookie storage singleton

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.WebCore             	0x0000000108db6ce9 WebCore::ReplaceSelectionCommand::doApply() + 10777 (Node.h:638)
1   com.apple.WebCore             	0x0000000108202216 WebCore::CompositeEditCommand::apply() + 102 (ScopedEventQueue.h:71)
2   com.apple.WebCore             	0x0000000108438714 WebCore::executeInsertFragment(WebCore::Frame&, WTF::PassRefPtr<WebCore::DocumentFragment>) + 84 (StdLibExtras.h:366)
3   com.apple.WebCore             	0x0000000108435d83 WebCore::executeInsertHTML(WebCore::Frame&, WebCore::Event*, WebCore::EditorCommandSource, WTF::String const&) + 99 (StdLibExtras.h:366)
4   com.apple.WebCore             	0x0000000108434876 WebCore::Editor::Command::execute(WTF::String const&, WebCore::Event*) const + 182 (EditorCommand.cpp:1704)
5   com.apple.WebCore             	0x000000010836dc36 WebCore::Document::execCommand(WTF::String const&, bool, WTF::String const&) + 214 (Document.cpp:4666)
6   com.apple.WebCore             	0x0000000108784074 WebCore::jsDocumentPrototypeFunctionExecCommand(JSC::ExecState*) + 420 (JSCJSValue.h:499)
7   ???                           	0x00004dc41f801028 0 + 85504737415208
8   com.apple.JavaScriptCore      	0x0000000107ae076f llint_entry + 22696
9   com.apple.JavaScriptCore      	0x0000000107adace4 vmEntryToJavaScript + 299
10  com.apple.JavaScriptCore      	0x000000010799b2d9 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 169 (JITCode.cpp:82)
11  com.apple.JavaScriptCore      	0x0000000107981a10 JSC::Interpreter::execute(JSC::ProgramExecutable*, JSC::ExecState*, JSC::JSObject*) + 10448 (Interpreter.cpp:945)
12  com.apple.JavaScriptCore      	0x00000001076944c5 JSC::evaluate(JSC::ExecState*, JSC::SourceCode const&, JSC::JSValue, WTF::NakedPtr<JSC::Exception>&) + 469 (Completion.cpp:104)
13  com.apple.WebCore             	0x0000000108df78ec WebCore::ScriptController::evaluateInWorld(WebCore::ScriptSourceCode const&, WebCore::DOMWrapperWorld&) + 284 (JSMainThreadExecState.h:62)
14  com.apple.WebCore             	0x0000000108df7b29 WebCore::ScriptController::evaluate(WebCore::ScriptSourceCode const&) + 41 (ScriptController.cpp:180)
15  com.apple.WebCore             	0x0000000108dfdaac WebCore::ScriptElement::executeScript(WebCore::ScriptSourceCode const&) + 316 (ScriptElement.cpp:309)
16  com.apple.WebCore             	0x0000000108dfc756 WebCore::ScriptElement::prepareScript(WTF::TextPosition const&, WebCore::ScriptElement::LegacyTypeSupport) + 1046 (StdLibExtras.h:366)
17  com.apple.WebCore             	0x00000001085f95eb WebCore::HTMLScriptRunner::runScript(WebCore::Element*, WTF::TextPosition const&) + 347 (ScriptElement.h:58)
18  com.apple.WebCore             	0x00000001085f9440 WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element>, WTF::TextPosition const&) + 48 (HTMLScriptRunner.cpp:191)
19  com.apple.WebCore             	0x000000010859c466 WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder() + 86 (StdLibExtras.h:366)
20  com.apple.WebCore             	0x000000010859c52d WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocumentParser::SynchronousMode, WebCore::PumpSession&) + 93 (HTMLDocumentParser.cpp:214)
21  com.apple.WebCore             	0x000000010859c0c3 WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode) + 595 (HTMLDocumentParser.cpp:259)
22  com.apple.WebCore             	0x000000010859cddd WebCore::HTMLDocumentParser::append(WTF::PassRefPtr<WTF::StringImpl>) + 669 (DocumentParser.h:71)
23  com.apple.WebCore             	0x000000010833f61c WebCore::DecodedDataDocumentParser::flush(WebCore::DocumentWriter&) + 92 (StdLibExtras.h:366)
24  com.apple.WebCore             	0x000000010839f68b WebCore::DocumentWriter::end() + 43 (RefPtr.h:71)
25  com.apple.WebCore             	0x00000001083879ec WebCore::DocumentLoader::finishedLoading(double) + 268 (ResourceErrorBase.h:42)
26  com.apple.WebCore             	0x00000001081b8179 WebCore::CachedResource::checkNotify() + 153 (CachedResourceClientWalker.h:51)
27  com.apple.WebCore             	0x00000001081b4433 WebCore::CachedRawResource::finishLoading(WebCore::SharedBuffer*) + 227 (CachedRawResource.cpp:104)
28  com.apple.WebCore             	0x0000000108f2f501 WebCore::SubresourceLoader::didFinishLoading(double) + 1153 (ResourceLoader.h:154)
29  com.apple.WebKit              	0x0000000106a7598d WebKit::WebResourceLoader::didReceiveWebResourceLoaderMessage(IPC::Connection&, IPC::MessageDecoder&) + 561 (HandleMessage.h:16)
30  com.apple.WebKit              	0x000000010684f1f1 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::MessageDecoder, std::__1::default_delete<IPC::MessageDecoder> >) + 127 (memory:2636)
31  com.apple.WebKit              	0x0000000106851b4a IPC::Connection::dispatchOneMessage() + 126 (memory:2656)
32  com.apple.JavaScriptCore      	0x0000000107c93985 WTF::RunLoop::performWork() + 437 (functional:1742)
33  com.apple.JavaScriptCore      	0x0000000107c93d32 WTF::RunLoop::performWork(void*) + 34 (RunLoopCF.cpp:39)
34  com.apple.CoreFoundation      	0x00007fff949e2c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
35  com.apple.CoreFoundation      	0x00007fff949d4b1c __CFRunLoopDoSources0 + 556
36  com.apple.CoreFoundation      	0x00007fff949d403f __CFRunLoopRun + 927
37  com.apple.CoreFoundation      	0x00007fff949d3a38 CFRunLoopRunSpecific + 296
38  com.apple.HIToolbox           	0x00007fff88e673bd RunCurrentEventLoopInMode + 235
39  com.apple.HIToolbox           	0x00007fff88e67153 ReceiveNextEventCommon + 432
40  com.apple.HIToolbox           	0x00007fff88e66f93 _BlockUntilNextEventMatchingListInModeWithFilter + 71
41  com.apple.AppKit              	0x00007fff870b81e7 _DPSNextEvent + 1076
42  com.apple.AppKit              	0x00007fff8748490d -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
43  com.apple.AppKit              	0x00007fff870ae0b8 -[NSApplication run] + 682
44  com.apple.AppKit              	0x00007fff87030396 NSApplicationMain + 1176
45  libxpc.dylib                  	0x00007fff8c70ff70 _xpc_objc_main + 793
46  libxpc.dylib                  	0x00007fff8c7116bf xpc_main + 494
47  com.apple.WebKit.WebContent.Development	0x00000001003e5424 main + 409 (XPCServiceMain.Development.mm:187)
48  libdyld.dylib                 	0x00007fff93aa15ad start + 1
Comment 1 Radar WebKit Bug Importer 2015-09-17 14:27:09 PDT
<rdar://problem/22746310>
Comment 2 Jiewen Tan 2015-10-21 17:01:29 PDT
Created attachment 263765 [details]
Patch
Comment 3 Chris Dumez 2015-10-26 11:59:47 PDT
Comment on attachment 263765 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=263765&action=review

r=me with comments.

> Source/WebCore/editing/ReplaceSelectionCommand.cpp:1468
>      if (isStart || isMiddle)

maybe:
if ((isStart || isMiddle) && lastNode->previousSibling())
    lastNode = lastNode->previousSibling()

to avoid the unnecessary assignment.

> LayoutTests/editing/execCommand/crash-replacing-list-by-list.html:3
> +Pass if not crash.

This does not sound like proper English. I would use "Pass if it does not crash".
Comment 4 Chris Dumez 2015-10-26 12:01:09 PDT
Comment on attachment 263765 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=263765&action=review

>> LayoutTests/editing/execCommand/crash-replacing-list-by-list.html:3
>> +Pass if not crash.
> 
> This does not sound like proper English. I would use "Pass if it does not crash".

Actually "Passes if it does not crash" would be better.
Comment 5 Jiewen Tan 2015-10-26 12:54:59 PDT
Created attachment 264065 [details]
Patch
Comment 6 WebKit Commit Bot 2015-10-26 16:08:53 PDT
Comment on attachment 264065 [details]
Patch

Clearing flags on attachment: 264065

Committed r191609: <http://trac.webkit.org/changeset/191609>
Comment 7 WebKit Commit Bot 2015-10-26 16:09:02 PDT
All reviewed patches have been landed.  Closing bug.