Closed Bug 1693045 Opened 3 years ago Closed 3 years ago

AddressSanitizer: SEGV /builds/worker/workspace/obj-build/dist/include/mozilla/RefPtr.h:310:45 in operator bool [@ mozilla::MediaEncoder::DisconnectTracks]

Categories

(Core :: Audio/Video: Recording, defect, P1)

defect

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox86 --- unaffected
firefox87 --- fixed
firefox88 --- fixed

People

(Reporter: jkratzer, Assigned: pehrsons)

References

(Blocks 1 open bug, Regression)

Details

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

Attachments

(5 files)

Attached file testcase.html

Testcase found while fuzzing mozilla-central rev fc74eb2c7b84 (built with --enable-address-sanitizer --enable-fuzzing).

    #0 0x7f7c33a53058 in operator bool /builds/worker/workspace/obj-build/dist/include/mozilla/RefPtr.h:310:45
    #1 0x7f7c33a53058 in mozilla::MediaEncoder::DisconnectTracks() /builds/worker/checkouts/gecko/dom/media/encoder/MediaEncoder.cpp:1016:7
    #2 0x7f7c33a5363c in mozilla::MediaEncoder::Cancel() /builds/worker/checkouts/gecko/dom/media/encoder/MediaEncoder.cpp:847:3
    #3 0x7f7c337b66a7 in mozilla::dom::MediaRecorder::Session::DoSessionEndTask(nsresult) /builds/worker/checkouts/gecko/dom/media/MediaRecorder.cpp:940:22
    #4 0x7f7c33773ec6 in mozilla::dom::MediaRecorder::Session::Start(mozilla::BaseTimeDuration<mozilla::TimeDurationValueCalculator>) /builds/worker/checkouts/gecko/dom/media/MediaRecorder.cpp:681:9
    #5 0x7f7c3376f3d1 in mozilla::dom::MediaRecorder::Start(mozilla::dom::Optional<unsigned int> const&, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/media/MediaRecorder.cpp:1349:28
    #6 0x7f7c3170af78 in mozilla::dom::MediaRecorder_Binding::start(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/MediaRecorderBinding.cpp:922:24
    #7 0x7f7c32a3e8d3 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/checkouts/gecko/dom/bindings/BindingUtils.cpp:3233:13
    #8 0x7f7c390d8616 in CallJSNative /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:435:13
    #9 0x7f7c390d8616 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:520:12
    #10 0x7f7c390da3ae in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:580:10
    #11 0x7f7c390c369d in CallFromStack /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:584:10
    #12 0x7f7c390c369d in Interpret(JSContext*, js::RunState&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:3243:16
    #13 0x7f7c390a7403 in js::RunScript(JSContext*, js::RunState&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:405:13
    #14 0x7f7c390d8746 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:552:13
    #15 0x7f7c390da3ae in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:580:10
    #16 0x7f7c390da62b in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:597:8
    #17 0x7f7c3995b602 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /builds/worker/checkouts/gecko/js/src/jsapi.cpp:2861:10
    #18 0x7f7c32691eb9 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:58:8
    #19 0x7f7c331b2978 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
    #20 0x7f7c331b23df in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/checkouts/gecko/dom/events/EventListenerManager.cpp:1101:43
    #21 0x7f7c331b3af7 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /builds/worker/checkouts/gecko/dom/events/EventListenerManager.cpp:1298:17
    #22 0x7f7c331a11ce in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /builds/worker/checkouts/gecko/dom/events/EventDispatcher.cpp:354:17
    #23 0x7f7c3319fa40 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/checkouts/gecko/dom/events/EventDispatcher.cpp:556:16
    #24 0x7f7c331a3d15 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /builds/worker/checkouts/gecko/dom/events/EventDispatcher.cpp:1099:11
    #25 0x7f7c359c7cab in nsDocumentViewer::LoadComplete(nsresult) /builds/worker/checkouts/gecko/layout/base/nsDocumentViewer.cpp:1103:7
    #26 0x7f7c38414390 in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) /builds/worker/checkouts/gecko/docshell/base/nsDocShell.cpp:6520:20
    #27 0x7f7c38413708 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/checkouts/gecko/docshell/base/nsDocShell.cpp:5876:7
    #28 0x7f7c384154bf in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/checkouts/gecko/docshell/base/nsDocShell.cpp
    #29 0x7f7c2fc093b6 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /builds/worker/checkouts/gecko/uriloader/base/nsDocLoader.cpp:1332:3
    #30 0x7f7c2fc08125 in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/uriloader/base/nsDocLoader.cpp:938:14
    #31 0x7f7c2fc050bc in nsDocLoader::DocLoaderIsEmpty(bool, mozilla::Maybe<nsresult> const&) /builds/worker/checkouts/gecko/uriloader/base/nsDocLoader.cpp:757:9
    #32 0x7f7c2fc06ef0 in nsDocLoader::OnStopRequest(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/uriloader/base/nsDocLoader.cpp:640:5
    #33 0x7f7c2fc07ccc in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/uriloader/base/nsDocLoader.cpp
    #34 0x7f7c2dd5c87b in mozilla::net::nsLoadGroup::NotifyRemovalObservers(nsIRequest*, nsresult) /builds/worker/checkouts/gecko/netwerk/base/nsLoadGroup.cpp:616:22
    #35 0x7f7c2dd5efe3 in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/checkouts/gecko/netwerk/base/nsLoadGroup.cpp:523:10
    #36 0x7f7c30ebd5f0 in mozilla::dom::Document::DoUnblockOnload() /builds/worker/checkouts/gecko/dom/base/Document.cpp:11065:18
    #37 0x7f7c30f3db8f in mozilla::dom::nsUnblockOnloadEvent::Run() /builds/worker/checkouts/gecko/dom/base/Document.cpp:11019:11
    #38 0x7f7c2da5b44c in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/checkouts/gecko/xpcom/threads/SchedulerGroup.cpp:146:20
    #39 0x7f7c2da66d56 in mozilla::RunnableTask::Run() /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:472:16
    #40 0x7f7c2da63912 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:753:26
    #41 0x7f7c2da617f7 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:611:15
    #42 0x7f7c2da61c4d in mozilla::TaskController::ProcessPendingMTTask(bool) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:395:36
    #43 0x7f7c2da6e391 in operator() /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:133:37
    #44 0x7f7c2da6e391 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_3>::Run() /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.h:534:5
    #45 0x7f7c2da896e4 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1158:16
    #46 0x7f7c2da9351c in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:548:10
    #47 0x7f7c2ec94f1f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:87:21
    #48 0x7f7c2eb9f5a1 in RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:335:10
    #49 0x7f7c2eb9f5a1 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:328:3
    #50 0x7f7c2eb9f5a1 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:310:3
    #51 0x7f7c353eb697 in nsBaseAppShell::Run() /builds/worker/checkouts/gecko/widget/nsBaseAppShell.cpp:137:27
    #52 0x7f7c38e8059f in XRE_RunAppShell() /builds/worker/checkouts/gecko/toolkit/xre/nsEmbedFunctions.cpp:902:20
    #53 0x7f7c2eb9f5a1 in RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:335:10
    #54 0x7f7c2eb9f5a1 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:328:3
    #55 0x7f7c2eb9f5a1 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:310:3
    #56 0x7f7c38e7fd2f in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/checkouts/gecko/toolkit/xre/nsEmbedFunctions.cpp:733:34
    #57 0x564a2ec4a16d in content_process_main(mozilla::Bootstrap*, int, char**) /builds/worker/checkouts/gecko/browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
    #58 0x564a2ec4a591 in main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:306:18
    #59 0x7f7c4d9c90b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
Flags: in-testsuite?

Bugmon Analysis:
Unable to reproduce bug using the following builds:

mozilla-central 20210216094005-fc74eb2c7b84
mozilla-central 20210216031051-00b18dc4bfac
Removing bugmon keyword as no further action possible.
Please review the bug and re-add the keyword for further analysis.

Keywords: bugmon
Whiteboard: [bugmon:confirm] → [bugmon:confirmed]

Andreas, possibly related to bug 1464268 or bug 1666487 also?

Flags: needinfo?(apehrson)
Blocks: 1693054
Assignee: nobody → apehrson
Severity: -- → S3
Status: NEW → ASSIGNED
Flags: needinfo?(apehrson)
Keywords: regression
Priority: -- → P1
Has Regression Range: --- → yes
Pushed by pehrsons@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/097f9d16e016
Add mochitest. r=bryce
https://hg.mozilla.org/integration/autoland/rev/de373b6c88ca
Account for null mEncoder in DoSessionEndTask. r=bryce
https://hg.mozilla.org/integration/autoland/rev/e4b833baf871
Generalize the use of mInvalidModificationDomException. r=bryce
https://hg.mozilla.org/integration/autoland/rev/56ecd705a9d9
Fire NotSupportedError when trying to record multiple tracks of one kind. r=bryce
No longer blocks: 1693054
Flags: in-testsuite? → in-testsuite+

Comment on attachment 9206687 [details]
Bug 1693045 - Account for null mEncoder in DoSessionEndTask. r?bryce!

Beta/Release Uplift Approval Request

  • User impact if declined: Applications could crash us at will.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): It's simple enough. We add a null check and if true we use an existing path to finish early.
  • String changes made/needed:
Attachment #9206687 - Flags: approval-mozilla-beta?
Attachment #9206686 - Flags: approval-mozilla-beta?

Comment on attachment 9206687 [details]
Bug 1693045 - Account for null mEncoder in DoSessionEndTask. r?bryce!

approved for 87.0b8

Attachment #9206687 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9206686 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: