Closed Bug 1734015 Opened 3 years ago Closed 2 years ago

Assertion failure: thisLine >= 0 (Failed to find line!), at /layout/generic/nsIFrame.cpp:8740

Categories

(Core :: Layout, defect)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
97 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox95 --- wontfix
firefox96 --- wontfix
firefox97 --- verified

People

(Reporter: jkratzer, Assigned: jfkthame)

References

(Blocks 1 open bug, Regression)

Details

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

Attachments

(2 files)

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

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build 9790289bfed7 --debug --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.html
Assertion failure: thisLine >= 0 (Failed to find line!), at /layout/generic/nsIFrame.cpp:8740

    ==291579==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f4275c286a7 bp 0x7ffd9a487d60 sp 0x7ffd9a487d10 T291579)
    ==291579==The signal is caused by a WRITE memory access.
    ==291579==Hint: address points to the zero page.
        #0 0x7f4275c286a7 in nsIFrame::PeekOffsetForLine(nsPeekOffsetStruct*) /layout/generic/nsIFrame.cpp:8740:5
        #1 0x7f4275c28f30 in nsIFrame::PeekOffset(nsPeekOffsetStruct*) /layout/generic/nsIFrame.cpp:8937:14
        #2 0x7f4275bacc03 in nsFrameSelection::PeekOffsetForCaretMove(nsDirection, bool, nsSelectionAmount, nsFrameSelection::CaretMovementStyle, nsPoint const&) const /layout/generic/nsFrameSelection.cpp:909:24
        #3 0x7f4275bac355 in nsFrameSelection::MoveCaret(nsDirection, bool, nsSelectionAmount, nsFrameSelection::CaretMovementStyle) /layout/generic/nsFrameSelection.cpp:785:49
        #4 0x7f4272bc2a20 in mozilla::dom::Selection::Modify(nsTSubstring<char16_t> const&, nsTSubstring<char16_t> const&, nsTSubstring<char16_t> const&, mozilla::ErrorResult&) /dom/base/Selection.cpp:3318:24
        #5 0x7f42735a90c5 in mozilla::dom::Selection_Binding::modify(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/SelectionBinding.cpp:1117:24
        #6 0x7f4273f9c178 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
        #7 0x7f4277731550 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:385:13
        #8 0x7f4277730c4e in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:472:12
        #9 0x7f427773264e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:532:10
        #10 0x7f4277727dc3 in CallFromStack /js/src/vm/Interpreter.cpp:536:10
        #11 0x7f4277727dc3 in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3239:16
        #12 0x7f427771ea55 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:354:13
        #13 0x7f4277730b47 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:504:13
        #14 0x7f427773264e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:532:10
        #15 0x7f4277732851 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:549:8
        #16 0x7f42778f2a01 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
        #17 0x7f4273ca578f 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
        #18 0x7f42743a0121 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
        #19 0x7f427439fe9a in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /dom/events/EventListenerManager.cpp:1115:43
        #20 0x7f42743a0b92 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1312:17
        #21 0x7f4274395a35 in HandleEvent /dom/events/EventListenerManager.h:394:5
        #22 0x7f4274395a35 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:348:17
        #23 0x7f4274394f4f in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:550:16
        #24 0x7f4274397b74 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1081:11
        #25 0x7f427439a7b6 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /dom/events/EventDispatcher.cpp
        #26 0x7f4272c80a45 in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /dom/base/nsINode.cpp:1339:17
        #27 0x7f4272976baa 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:4310:28
        #28 0x7f4272976a36 in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) /dom/base/nsContentUtils.cpp:4280:10
        #29 0x7f4272ae80c7 in mozilla::dom::Document::DispatchContentLoadedEvents() /dom/base/Document.cpp:7822:3
        #30 0x7f4272b5b376 in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1147:12
        #31 0x7f4272b5b376 in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1153:12
        #32 0x7f4272b5b376 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
        #33 0x7f4270e18bd2 in mozilla::SchedulerGroup::Runnable::Run() /xpcom/threads/SchedulerGroup.cpp:144:20
        #34 0x7f4270e46b3e in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:467:16
        #35 0x7f4270e21def in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:770:26
        #36 0x7f4270e20a58 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:606:15
        #37 0x7f4270e20cd3 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:390:36
        #38 0x7f4270e4a096 in operator() /xpcom/threads/TaskController.cpp:123:37
        #39 0x7f4270e4a096 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:531:5
        #40 0x7f4270e355ef in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1148:16
        #41 0x7f4270e3c33a in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:467:10
        #42 0x7f42718a4006 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:85:21
        #43 0x7f42717c46f7 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:331:10
        #44 0x7f42717c4602 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #45 0x7f42717c4602 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #46 0x7f427571d9b8 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:137:27
        #47 0x7f42775b5613 in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:917:20
        #48 0x7f42718a4efa in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:235:9
        #49 0x7f42717c46f7 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:331:10
        #50 0x7f42717c4602 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #51 0x7f42717c4602 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #52 0x7f42775b4c4e in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:749:34
        #53 0x557441aadb46 in content_process_main /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
        #54 0x557441aadb46 in main /browser/app/nsBrowserApp.cpp:327:18
        #55 0x7f428665a0b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
        #56 0x557441a8a94c in _start (/home/jkratzer/builds/mc-debug/firefox-bin+0x1594c)
    
    UndefinedBehaviorSanitizer can not provide additional info.
    SUMMARY: UndefinedBehaviorSanitizer: SEGV /layout/generic/nsIFrame.cpp:8740:5 in nsIFrame::PeekOffsetForLine(nsPeekOffsetStruct*)
    ==291579==ABORTING
Attached file Testcase

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

Start: c0895896f8e35fc323ab7b81e907cd517a99ed3b (20210924091825)
End: 4e8c68a872fe1601f9f05a2ddc43b1335413a383 (20210924142247)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=c0895896f8e35fc323ab7b81e907cd517a99ed3b&tochange=4e8c68a872fe1601f9f05a2ddc43b1335413a383

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

The severity field is not set for this bug.
:TYLin, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(aethanyc)
Attachment #9244262 - Attachment mime type: text/plain → text/html
Flags: needinfo?(aethanyc)

The testcase triggers an assertion in debug build, but is not crashing the release build for me.

Jonathan, this may be related to one of your bugs fixing line-iterator. Mind taking a look?

Severity: -- → S3
Flags: needinfo?(jfkthame)

Sure, I'll try and look into this. Leaving ni? flag for now.

Flags: needinfo?(jfkthame)
Keywords: regression
Regressed by: 1732349
Has Regression Range: --- → yes

The assertion here was added during the iterator refactoring in bug 1732349,
but is actually bogus. The old code would have returned via the MOZ_TRY_VAR
that wrapped the call to blockFrame->GetLineNumber(); that's replaced by
iter->FindLineContaining(), so we should now check for an error there and
similarly just return to the caller, not assert.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/264d7b53587a
Just return an error (without asserting) from PeekOffsetForLine if line is not found. r=layout-reviewers,emilio
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch

Bugmon Analysis
Verified bug as fixed on rev mozilla-central 20220103215519-a6af5cff5adf.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

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

Attachment

General

Created:
Updated:
Size: