Open Bug 1730698 Opened 3 years ago Updated 9 months ago

Assertion failure: aStartOfDeepestRightNode.GetContainer() == &aMostAncestorToSplit || EditorUtils::IsDescendantOf(*aStartOfDeepestRightNode.GetContainer(), aMostAncestorToSplit), at /editor/libeditor/HTMLEditor.cpp:4256

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

ASSIGNED
Tracking Status
firefox-esr78 --- unaffected
firefox-esr91 --- unaffected
firefox-esr102 --- wontfix
firefox-esr115 --- wontfix
firefox92 --- unaffected
firefox93 --- wontfix
firefox94 --- wontfix
firefox115 --- wontfix
firefox116 --- wontfix
firefox117 --- wontfix

People

(Reporter: jkratzer, Assigned: masayuki)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: bugmon, regression, testcase, Whiteboard: [bugmon:bisected,confirmed])

Attachments

(1 file, 1 obsolete file)

Testcase found while fuzzing mozilla-central rev b50ef8e31c4c (built with: --enable-debug --enable-fuzzing).

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build b50ef8e31c4c --debug --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.html
Assertion failure: aStartOfDeepestRightNode.GetContainer() == &aMostAncestorToSplit || EditorUtils::IsDescendantOf(*aStartOfDeepestRightNode.GetContainer(), aMostAncestorToSplit), at /editor/libeditor/HTMLEditor.cpp:4256

    ==2763232==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fd730868d72 bp 0x7ffddf4477a0 sp 0x7ffddf447680 T2763232)
    ==2763232==The signal is caused by a WRITE memory access.
    ==2763232==Hint: address points to the zero page.
        #0 0x7fd730868d72 in mozilla::HTMLEditor::SplitNodeDeepWithTransaction(nsIContent&, mozilla::EditorDOMPointBase<nsCOMPtr<nsINode>, nsCOMPtr<nsIContent> > const&, mozilla::HTMLEditor::SplitAtEdges) /editor/libeditor/HTMLEditor.cpp:4253:3
        #1 0x7fd73088dc86 in mozilla::HTMLEditor::SplitElementsAtEveryBRElement(nsIContent&, nsTArray<mozilla::OwningNonNull<nsIContent> >&) /editor/libeditor/HTMLEditSubActionHandler.cpp:6815:39
        #2 0x7fd73088ce9a in mozilla::HTMLEditor::MaybeSplitElementsAtEveryBRElement(nsTArray<mozilla::OwningNonNull<nsIContent> >&, mozilla::EditSubAction) /editor/libeditor/HTMLEditSubActionHandler.cpp:6674:25
        #3 0x7fd73087ff0f in mozilla::HTMLEditor::SplitInlinesAndCollectEditTargetNodes(nsTArray<RefPtr<nsRange> >&, nsTArray<mozilla::OwningNonNull<nsIContent> >&, mozilla::EditSubAction, mozilla::HTMLEditor::CollectNonEditableNodes) /editor/libeditor/HTMLEditSubActionHandler.cpp:6433:8
        #4 0x7fd73087392e in mozilla::HTMLEditor::SplitInlinesAndCollectEditTargetNodesInExtendedSelectionRanges(nsTArray<mozilla::OwningNonNull<nsIContent> >&, mozilla::EditSubAction, mozilla::HTMLEditor::CollectNonEditableNodes) /builds/worker/workspace/obj-build/dist/include/mozilla/HTMLEditor.h:1357:19
        #5 0x7fd730863bf7 in mozilla::HTMLEditor::FormatBlockContainerWithTransaction(nsAtom&) /editor/libeditor/HTMLEditSubActionHandler.cpp:3490:17
        #6 0x7fd7308a7cc6 in mozilla::HTMLEditor::FormatBlockContainerAsSubAction(nsAtom&) /editor/libeditor/HTMLEditor.cpp:2540:8
        #7 0x7fd7308a7891 in mozilla::HTMLEditor::SetParagraphFormatAsAction(nsTSubstring<char16_t> const&, nsIPrincipal*) /editor/libeditor/HTMLEditor.cpp:2061:8
        #8 0x7fd7308ba2cb in mozilla::ParagraphStateCommand::SetState(mozilla::HTMLEditor*, nsTSubstring<char16_t> const&, nsIPrincipal*) const /editor/libeditor/HTMLEditorCommands.cpp:555:30
        #9 0x7fd7308b9f8e in mozilla::MultiStateCommandBase::DoCommandParam(mozilla::Command, nsTSubstring<char16_t> const&, mozilla::EditorBase&, nsIPrincipal*) const /editor/libeditor/HTMLEditorCommands.cpp:497:17
        #10 0x7fd72dacf2b9 in mozilla::dom::Document::ExecCommand(nsTSubstring<char16_t> const&, bool, nsTSubstring<char16_t> const&, nsIPrincipal&, mozilla::ErrorResult&) /dom/base/Document.cpp:5334:27
        #11 0x7fd72ec13b73 in mozilla::dom::Document_Binding::execCommand(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/DocumentBinding.cpp:3476:36
        #12 0x7fd72efa6158 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /dom/bindings/BindingUtils.cpp:3300:13
        #13 0x7fd732733110 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:401:13
        #14 0x7fd73273280e in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:488:12
        #15 0x7fd73273420e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:548:10
        #16 0x7fd7327297e0 in CallFromStack /js/src/vm/Interpreter.cpp:552:10
        #17 0x7fd7327297e0 in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3255:16
        #18 0x7fd732720435 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:370:13
        #19 0x7fd732732707 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:520:13
        #20 0x7fd73273420e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:548:10
        #21 0x7fd732734411 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) /js/src/vm/Interpreter.cpp:565:8
        #22 0x7fd732915f13 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /js/src/vm/CallAndConstruct.cpp:117:10
        #23 0x7fd72eca7e4e in mozilla::dom::EventListener::HandleEvent(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/bindings/EventListenerBinding.cpp:62:8
        #24 0x7fd72f3b28d6 in void mozilla::dom::EventListener::HandleEvent<mozilla::dom::EventTarget*>(mozilla::dom::EventTarget* const&, mozilla::dom::Event&, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/obj-build/dist/include/mozilla/dom/EventListenerBinding.h:65:12
        #25 0x7fd72f3b262a in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /dom/events/EventListenerManager.cpp:1115:43
        #26 0x7fd72f3b3382 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1312:17
        #27 0x7fd72f3a81c5 in HandleEvent /dom/events/EventListenerManager.h:394:5
        #28 0x7fd72f3a81c5 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:348:17
        #29 0x7fd72f3a76df in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:550:16
        #30 0x7fd72f3aa304 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1081:11
        #31 0x7fd72f3acf46 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /dom/events/EventDispatcher.cpp
        #32 0x7fd72dc739f5 in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /dom/base/nsINode.cpp:1339:17
        #33 0x7fd72d9699da in nsContentUtils::DispatchEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, mozilla::Trusted, bool*, mozilla::ChromeOnlyDispatch) /dom/base/nsContentUtils.cpp:4301:28
        #34 0x7fd72d969866 in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) /dom/base/nsContentUtils.cpp:4271:10
        #35 0x7fd72dadbcb7 in mozilla::dom::Document::DispatchContentLoadedEvents() /dom/base/Document.cpp:7799:3
        #36 0x7fd72db4d966 in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1147:12
        #37 0x7fd72db4d966 in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1153:12
        #38 0x7fd72db4d966 in mozilla::detail::RunnableMethodImpl<mozilla::dom::Document*, void (mozilla::dom::Document::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1200:13
        #39 0x7fd72bdfef52 in mozilla::SchedulerGroup::Runnable::Run() /xpcom/threads/SchedulerGroup.cpp:144:20
        #40 0x7fd72be2ce9e in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:478:16
        #41 0x7fd72be0816f in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:781:26
        #42 0x7fd72be06dd8 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:617:15
        #43 0x7fd72be07053 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:401:36
        #44 0x7fd72be303e6 in operator() /xpcom/threads/TaskController.cpp:126:37
        #45 0x7fd72be303e6 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:531:5
        #46 0x7fd72be1b94f in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1148:16
        #47 0x7fd72be2269a in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:466:10
        #48 0x7fd72c87c406 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:85:21
        #49 0x7fd72c79c937 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:331:10
        #50 0x7fd72c79c842 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #51 0x7fd72c79c842 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #52 0x7fd730730e48 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:137:27
        #53 0x7fd7325b6783 in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:917:20
        #54 0x7fd72c87d2fa in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:235:9
        #55 0x7fd72c79c937 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:331:10
        #56 0x7fd72c79c842 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #57 0x7fd72c79c842 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #58 0x7fd7325b5dbe in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:749:34
        #59 0x563623365b46 in content_process_main /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
        #60 0x563623365b46 in main /browser/app/nsBrowserApp.cpp:327:18
        #61 0x7fd7416010b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
        #62 0x56362334294c in _start (/home/jkratzer/builds/mc-debug/firefox-bin+0x1594c)
    
    UndefinedBehaviorSanitizer can not provide additional info.
    SUMMARY: UndefinedBehaviorSanitizer: SEGV /editor/libeditor/HTMLEditor.cpp:4253:3 in mozilla::HTMLEditor::SplitNodeDeepWithTransaction(nsIContent&, mozilla::EditorDOMPointBase<nsCOMPtr<nsINode>, nsCOMPtr<nsIContent> > const&, mozilla::HTMLEditor::SplitAtEdges)
    ==2763232==ABORTING
Attached file Testcase (obsolete) —

Bugmon Analysis
Verified bug as reproducible on mozilla-central 20210914143556-ae68c3ee95d6.
The bug appears to have been introduced in the following build range:

Start: 51da48dca80b562d7dc77aad4b98af0d6ea08412 (20210823011237)
End: 76accb62cb073b7a7392a5f6c05cc30e02b35c1e (20210823053252)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=51da48dca80b562d7dc77aad4b98af0d6ea08412&tochange=76accb62cb073b7a7392a5f6c05cc30e02b35c1e

Whiteboard: [bugmon:confirm] → [bugmon:bisected,confirmed]

(In reply to Bugmon [:jkratzer for issues] from comment #2)

Bugmon Analysis
Verified bug as reproducible on mozilla-central 20210914143556-ae68c3ee95d6.
The bug appears to have been introduced in the following build range:

Start: 51da48dca80b562d7dc77aad4b98af0d6ea08412 (20210823011237)
End: 76accb62cb073b7a7392a5f6c05cc30e02b35c1e (20210823053252)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=51da48dca80b562d7dc77aad4b98af0d6ea08412&tochange=76accb62cb073b7a7392a5f6c05cc30e02b35c1e

The pushlog hinted this may be caused by Bug 1726064 .

Flags: needinfo?(masayuki)

Yeah, must be that its "part 17" is the cause.

Assignee: nobody → masayuki
Severity: -- → S3
Status: NEW → ASSIGNED
Flags: needinfo?(masayuki)
OS: Linux → All
Priority: -- → P3
Regressed by: 1726064
Hardware: x86_64 → All
Has Regression Range: --- → yes
Keywords: regression

FYI: heading will be unshipped because of Gecko specific and not used.

Attachment #9241130 - Attachment mime type: text/plain → text/html
Attached file minimized testcase

This is minimized testcase for the assertion hit in editor. However, the original testcase has other crash bug. I'll file it.

Attachment #9241130 - Attachment is obsolete: true

Set release status flags based on info from the regressing bug 1726064

It is what the assertion detect is, HTMLEditor behaves odd when there is an inline non-editable elements. When formatting block, HTMLEditor tries to extend target range for a line (if collapsed or non-collapsed in a line) or multiple lines (if non-collapsed and across multiple lines). At this time HTMLEditor refers any <br> elements even if it or its parent is not editable. Therefore, the assertion detects non-editable node is being split. However, ignoring such <br> element is also odd. Then, I write WPT for the cases. Then, Blink treats non-editable inline nodes as boundaries to stop expanding the range. So we need to follow the behavior. Without doing it, I have no idea about reasonable fix.

Bugmon was unable reproduce this issue.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Keywords: bugmon

A change to the Taskcluster build definitions over the weekend caused Bugmon to fail when reproducing issues. This issue has been corrected. Re-enabling bugmon.

Keywords: bugmon
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: