Closed Bug 1755710 Opened 3 years ago Closed 1 year ago

Assertion failure: rangeToDelete.EndRef() == replaceRangeDataAtEnd.StartRef() || replaceRangeDataAtEnd.StartRef().IsStartOfContainer(), at /editor/libeditor/WSRunObject.cpp:2131

Categories

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

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
116 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox-esr102 --- wontfix
firefox-esr115 --- wontfix
firefox97 --- wontfix
firefox98 --- wontfix
firefox99 --- wontfix
firefox100 --- wontfix
firefox106 --- wontfix
firefox107 --- wontfix
firefox108 --- wontfix
firefox114 --- wontfix
firefox115 --- wontfix
firefox116 --- verified

People

(Reporter: jkratzer, Assigned: masayuki)

References

(Blocks 1 open bug, Regression)

Details

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

Attachments

(3 files)

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

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build ae6487188557 --debug --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.html
Assertion failure: rangeToDelete.EndRef() == replaceRangeDataAtEnd.StartRef() || replaceRangeDataAtEnd.StartRef().IsStartOfContainer(), at /editor/libeditor/WSRunObject.cpp:2131

    ==184008==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fb61e963856 bp 0x7ffe1103a980 sp 0x7ffe1103a2e0 T184008)
    ==184008==The signal is caused by a WRITE memory access.
    ==184008==Hint: address points to the zero page.
        #0 0x7fb61e963856 in mozilla::WhiteSpaceVisibilityKeeper::MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange(mozilla::HTMLEditor&, mozilla::EditorDOMRangeBase<mozilla::EditorDOMPointBase<nsCOMPtr<nsINode>, nsCOMPtr<nsIContent> > > const&) /editor/libeditor/WSRunObject.cpp:2128:5
        #1 0x7fb61e8fc83b in PrepareToDeleteRange /editor/libeditor/WSRunObject.h:1354:19
        #2 0x7fb61e8fc83b in mozilla::HTMLEditor::AutoDeleteRangesHandler::HandleDeleteNonCollapsedRanges(mozilla::HTMLEditor&, short, short, mozilla::AutoRangeArray&, mozilla::HTMLEditor::AutoDeleteRangesHandler::SelectionWasCollapsed) /editor/libeditor/HTMLEditorDeleteHandler.cpp:3034:19
        #3 0x7fb61e8f83fb in mozilla::HTMLEditor::AutoDeleteRangesHandler::Run(mozilla::HTMLEditor&, short, short, mozilla::AutoRangeArray&) /editor/libeditor/HTMLEditorDeleteHandler.cpp:1641:29
        #4 0x7fb61e8f70a2 in mozilla::HTMLEditor::HandleDeleteSelection(short, short) /editor/libeditor/HTMLEditorDeleteHandler.cpp:1126:43
        #5 0x7fb61e83ff1d in mozilla::EditorBase::DeleteSelectionAsSubAction(short, short) /editor/libeditor/EditorBase.cpp:4215:7
        #6 0x7fb61e8c96c8 in mozilla::HTMLEditor::DeleteSelectionAndPrepareToCreateNode() /editor/libeditor/HTMLEditor.cpp:5077:9
        #7 0x7fb61e8c8c92 in mozilla::HTMLEditor::InsertElementAtSelectionAsAction(mozilla::dom::Element*, bool, nsIPrincipal*) /editor/libeditor/HTMLEditor.cpp:1785:19
        #8 0x7fb61e8e15a5 in mozilla::InsertTagCommand::DoCommand(mozilla::Command, mozilla::EditorBase&, nsIPrincipal*) const /editor/libeditor/HTMLEditorCommands.cpp:1201:13
        #9 0x7fb61b805dc4 in mozilla::dom::Document::ExecCommand(nsTSubstring<char16_t> const&, bool, nsTSubstring<char16_t> const&, nsIPrincipal&, mozilla::ErrorResult&) /dom/base/Document.cpp:5409:37
        #10 0x7fb61ca77bd3 in mozilla::dom::Document_Binding::execCommand(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/DocumentBinding.cpp:3826:36
        #11 0x7fb61cdedfb8 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:3306:13
        #12 0x7fb62094a1cf in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:425:13
        #13 0x7fb6209498cd in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:512:12
        #14 0x7fb62094b3ae in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:572:10
        #15 0x7fb620940c66 in CallFromStack /js/src/vm/Interpreter.cpp:576:10
        #16 0x7fb620940c66 in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3309:16
        #17 0x7fb620937b63 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:394:13
        #18 0x7fb6209497c8 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:544:13
        #19 0x7fb62094b3ae in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:572:10
        #20 0x7fb62094b5b1 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:589:8
        #21 0x7fb620a7b3b1 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
        #22 0x7fb61cb0d1d7 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
        #23 0x7fb61d2f44d6 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
        #24 0x7fb61d2f425a in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /dom/events/EventListenerManager.cpp:1308:43
        #25 0x7fb61d2f4f59 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1505:17
        #26 0x7fb61d2e9f64 in HandleEvent /dom/events/EventListenerManager.h:395:5
        #27 0x7fb61d2e9f64 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:348:17
        #28 0x7fb61d2e9487 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:550:16
        #29 0x7fb61d2ebce8 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1085:11
        #30 0x7fb61d2ee5a6 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /dom/events/EventDispatcher.cpp
        #31 0x7fb61ba99aad in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /dom/base/nsINode.cpp:1354:17
        #32 0x7fb61b5e9e6a 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:4311:28
        #33 0x7fb61b5e9c67 in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) /dom/base/nsContentUtils.cpp:4281:10
        #34 0x7fb61b81957f in mozilla::dom::Document::DispatchContentLoadedEvents() /dom/base/Document.cpp:7886:3
        #35 0x7fb61b8cae8b in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1147:12
        #36 0x7fb61b8cae8b in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1153:12
        #37 0x7fb61b8cae8b 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
        #38 0x7fb6199b4042 in mozilla::SchedulerGroup::Runnable::Run() /xpcom/threads/SchedulerGroup.cpp:140:20
        #39 0x7fb6199e4e6e in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:467:16
        #40 0x7fb6199be096 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:770:26
        #41 0x7fb6199bcd58 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:606:15
        #42 0x7fb6199bcfd3 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:390:36
        #43 0x7fb6199e8316 in operator() /xpcom/threads/TaskController.cpp:124:37
        #44 0x7fb6199e8316 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:531:5
        #45 0x7fb6199d2fe3 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1171:16
        #46 0x7fb6199da4fa in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:467:10
        #47 0x7fb61a486a96 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:85:21
        #48 0x7fb61a3a3bc7 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:331:10
        #49 0x7fb61a3a3ad2 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #50 0x7fb61a3a3ad2 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #51 0x7fb61e75bd98 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:137:27
        #52 0x7fb6207cd923 in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:878:20
        #53 0x7fb61a48798a in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:235:9
        #54 0x7fb61a3a3bc7 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:331:10
        #55 0x7fb61a3a3ad2 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #56 0x7fb61a3a3ad2 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #57 0x7fb6207ccf5c in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:715:34
        #58 0x561d73a0ed37 in content_process_main /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
        #59 0x561d73a0ed37 in main /browser/app/nsBrowserApp.cpp:327:18
        #60 0x7fb63004e0b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
        #61 0x561d739ea4bc in _start (/home/jkratzer/builds/mc-debug/firefox-bin+0x154bc)
    
    UndefinedBehaviorSanitizer can not provide additional info.
    SUMMARY: UndefinedBehaviorSanitizer: SEGV /editor/libeditor/WSRunObject.cpp:2128:5 in mozilla::WhiteSpaceVisibilityKeeper::MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange(mozilla::HTMLEditor&, mozilla::EditorDOMRangeBase<mozilla::EditorDOMPointBase<nsCOMPtr<nsINode>, nsCOMPtr<nsIContent> > > const&)
    ==184008==ABORTING
Attached file Testcase

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

Start: 69ec751137351788704832e330a058ce87e1f128 (20210330033415)
End: 76a14c19f458d133cc05d5eb195799644fe524c1 (20210330075731)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=69ec751137351788704832e330a058ce87e1f128&tochange=76a14c19f458d133cc05d5eb195799644fe524c1

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

The assertion introduced in bug 1655988 detects an unexpected scenario in the method. Let's check it later.

Severity: -- → S3
Priority: -- → P3
Regressed by: 1655988

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

Has Regression Range: --- → yes
Attachment #9264160 - Attachment mime type: text/plain → text/html
Assignee: nobody → masayuki
Status: NEW → ASSIGNED

It seems that this is a bug of the assertion.

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

The assertion was introduced in bug 1655988. However, the assertion assumes
that the given range ends before start of the deleting range (invisible
white-spaces), but that is wrong, the range may ends in middle of or end of
collapsible white-spaces. Therefore, this patch just fixes the assertion.

Depends on D180783

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/cb7a3fba21af Fix the assertion in `WhiteSpaceVisibilityKeeper::MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange` r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/40580 for changes under testing/web-platform/tests
Whiteboard: [bugmon:bisected,confirmed] → [bugmon:bisected,confirmed], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
Upstream PR merged by moz-wptsync-bot

Bug appears to be fixed on mozilla-central 20230616094829-6a640a4dd324 but BugMon was unable to find a usable build for ae6487188557.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

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

Attachment

General

Created:
Updated:
Size: