Skip to content
Memory corruption Disclosed report

Heap-use-after-free in mozilla::dom::HTMLMediaElement::NotifyDecoderPrincipalChanged

Abhishek Arya Follow

Originally disclosed on Mozilla

  • Fixed in 17 days
  • Paid in 31 days
  • Disclosed after 17 days

Created attachment 8744548 Testcase

Load testcase test.html in multiple tabs (4-5) and wait for 30-60 sec to see this crash in one of the tabs.

==7931==ERROR: AddressSanitizer: heap-use-after-free on address 0x6080008191e8 at pc 0x7fbee23df088 bp 0x7fff819e94b0 sp 0x7fff819e94a8 READ of size 8 at 0x6080008191e8 thread T0 (Web Content) #0 0x7fbee23df087 in mozilla::dom::HTMLMediaElement::NotifyDecoderPrincipalChanged() /build/firefox/src/dom/html/HTMLMediaElement.cpp:4403:5 #1 0x7fbee23cb2c5 in mozilla::dom::HTMLMediaElement::FinishDecoderSetup(mozilla::MediaDecoder*, mozilla::MediaResource*, nsIStreamListener**) /build/firefox/src/dom/html/HTMLMediaElement.cpp:3033:3 #2 0x7fbee23cac57 in mozilla::dom::HTMLMediaElement::InitializeDecoderAsClone(mozilla::MediaDecoder*) /build/firefox/src/dom/html/HTMLMediaElement.cpp:2953:10 #3 0x7fbee23c5fef in mozilla::dom::HTMLMediaElement::LoadResource() /build/firefox/src/dom/html/HTMLMediaElement.cpp:1261:19 #4 0x7fbee23c25fe in mozilla::dom::HTMLMediaElement::LoadFromSourceChildren() /build/firefox/src/dom/html/HTMLMediaElement.cpp:1107:9 #5 0x7fbee23c41b5 in mozilla::dom::HTMLMediaElement::SelectResource() /build/firefox/src/dom/html/HTMLMediaElement.cpp:969:5 #6 0x7fbee23c38ed in mozilla::dom::HTMLMediaElement::SelectResourceWrapper() /build/firefox/src/dom/html/HTMLMediaElement.cpp:905:3 #7 0x7fbee23ff790 in applyImpl<mozilla::dom::HTMLMediaElement, void (mozilla::dom::HTMLMediaElement::)()> /build/firefox/src/objdir-ff-asan/dist/include/nsThreadUtils.h:671:12 #8 0x7fbee23ff790 in apply<mozilla::dom::HTMLMediaElement, void (mozilla::dom::HTMLMediaElement::)()> /build/firefox/src/objdir-ff-asan/dist/include/nsThreadUtils.h:677 #9 0x7fbee23ff790 in nsRunnableMethodImpl<void (mozilla::dom::HTMLMediaElement::)(), true>::Run() /build/firefox/src/objdir-ff-asan/dist/include/nsThreadUtils.h:705 #10 0x7fbee23f81cf in mozilla::dom::nsSyncSection::Run() /build/firefox/src/dom/html/HTMLMediaElement.cpp:821:5 #11 0x7fbedd2518e7 in mozilla::CycleCollectedJSRuntime::ProcessStableStateQueue() /build/firefox/src/xpcom/base/CycleCollectedJSRuntime.cpp:1327:5 #12 0x7fbedec9c121 in XPCJSRuntime::AfterProcessTask(unsigned int) /build/firefox/src/js/xpconnect/src/XPCJSRuntime.cpp:3719:5 #13 0x7fbedd394fec in nsThread::ProcessNextEvent(bool, bool) /build/firefox/src/xpcom/threads/nsThread.cpp:1009:5 #14 0x7fbedd414b8c in NS_ProcessNextEvent(nsIThread*, bool) /build/firefox/src/xpcom/glue/nsThreadUtils.cpp:290:10 #15 0x7fbede16472f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /build/firefox/src/ipc/glue/MessagePump.cpp:98:21 #16 0x7fbede0daa71 in RunInternal /build/firefox/src/ipc/chromium/src/base/message_loop.cc:230:3 #17 0x7fbede0daa71 in RunHandler /build/firefox/src/ipc/chromium/src/base/message_loop.cc:223 #18 0x7fbede0daa71 in MessageLoop::Run() /build/firefox/src/ipc/chromium/src/base/message_loop.cc:203 #19 0x7fbee394ebff in nsBaseAppShell::Run() /build/firefox/src/widget/nsBaseAppShell.cpp:156:3 #20 0x7fbee5a52053 in XRE_RunAppShell /build/firefox/src/toolkit/xre/nsEmbedFunctions.cpp:801:12 #21 0x7fbede0daa71 in RunInternal /build/firefox/src/ipc/chromium/src/base/message_loop.cc:230:3 #22 0x7fbede0daa71 in RunHandler /build/firefox/src/ipc/chromium/src/base/message_loop.cc:223 #23 0x7fbede0daa71 in MessageLoop::Run() /build/firefox/src/ipc/chromium/src/base/message_loop.cc:203 #24 0x7fbee5a515f9 in XRE_InitChildProcess /build/firefox/src/toolkit/xre/nsEmbedFunctions.cpp:637:7 #25 0x4eaade in content_process_main(int, char**) /build/firefox/src/ipc/app/../contentproc/plugin-container.cpp:237:19 #26 0x7fbeda4fcec4 in __libc_start_main #27 0x41dbc6 in _start

0x6080008191e8 is located 72 bytes inside of 88-byte region [0x6080008191a0,0x6080008191f8) freed by thread T0 (Web Content) here: #0 0x4b9600 in __interceptor_free asan_rtl #1 0x7fbedd26c025 in SnowWhiteKiller::~SnowWhiteKiller() /build/firefox/src/xpcom/base/nsCycleCollector.cpp:2675:9 #2 0x7fbedd26bb5a in nsCycleCollector::FreeSnowWhite(bool) /build/firefox/src/xpcom/base/nsCycleCollector.cpp:2849:3 #3 0x7fbedecb345e in AsyncFreeSnowWhite::Run() /build/firefox/src/js/xpconnect/src/XPCJSRuntime.cpp:155:34 #4 0x7fbedd394b35 in nsThread::ProcessNextEvent(bool, bool*) /build/firefox/src/xpcom/threads/nsThread.cpp:994:7 #5 0x7fbedd414b8c in NS_ProcessNextEvent(nsIThread*, bool) /build/firefox/src/xpcom/glue/nsThreadUtils.cpp:290:10 #6 0x7fbede16472f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /build/firefox/src/ipc/glue/MessagePump.cpp:98:21 #7 0x7fbede0daa71 in RunInternal /build/firefox/src/ipc/chromium/src/base/message_loop.cc:230:3 #8 0x7fbede0daa71 in RunHandler /build/firefox/src/ipc/chromium/src/base/message_loop.cc:223 #9 0x7fbede0daa71 in MessageLoop::Run() /build/firefox/src/ipc/chromium/src/base/message_loop.cc:203 #10 0x7fbee394ebff in nsBaseAppShell::Run() /build/firefox/src/widget/nsBaseAppShell.cpp:156:3 #11 0x7fbee5a52053 in XRE_RunAppShell /build/firefox/src/toolkit/xre/nsEmbedFunctions.cpp:801:12 #12 0x7fbede0daa71 in RunInternal /build/firefox/src/ipc/chromium/src/base/message_loop.cc:230:3 #13 0x7fbede0daa71 in RunHandler /build/firefox/src/ipc/chromium/src/base/message_loop.cc:223 #14 0x7fbede0daa71 in MessageLoop::Run() /build/firefox/src/ipc/chromium/src/base/message_loop.cc:203 #15 0x7fbee5a515f9 in XRE_InitChildProcess /build/firefox/src/toolkit/xre/nsEmbedFunctions.cpp:637:7 #16 0x4eaade in content_process_main(int, char**) /build/firefox/src/ipc/app/../contentproc/plugin-container.cpp:237:19 #17 0x7fbeda4fcec4 in __libc_start_main

previously allocated by thread T0 (Web Content) here: #0 0x4b98f8 in __interceptor_malloc asan_rtl #1 0x4eacfd in moz_xmalloc /build/firefox/src/memory/mozalloc/mozalloc.cpp:83:17 #2 0x7fbee23f6c49 in operator new /build/firefox/src/objdir-ff-asan/dist/include/mozilla/mozalloc.h:186:12 #3 0x7fbee23f6c49 in mozilla::dom::HTMLMediaElement::CaptureStreamTrackSourceGetter::GetMediaStreamTrackSource(int) /build/firefox/src/dom/html/HTMLMediaElement.cpp:1981 #4 0x7fbee23d4bbf in mozilla::dom::HTMLMediaElement::CaptureStreamInternal(bool, mozilla::MediaStreamGraph*) /build/firefox/src/dom/html/HTMLMediaElement.cpp:2047:11 #5 0x7fbee23d5279 in mozilla::dom::HTMLMediaElement::MozCaptureStreamUntilEnded(mozilla::ErrorResult&, mozilla::MediaStreamGraph*) /build/firefox/src/dom/html/HTMLMediaElement.cpp:2074:35 #6 0x7fbee1beb49f in mozilla::dom::HTMLMediaElementBinding::mozCaptureStreamUntilEnded(JSContext*, JS::Handle<JSObject*>, mozilla::dom::HTMLMediaElement*, JSJitMethodCallArgs const&) /build/firefox/src/objdir-ff-asan/dom/bindings/HTMLMediaElementBinding.cpp:1975:55 #7 0x7fbee1d9849a in mozilla::dom::GenericBindingMethod(JSContext*, unsigned int, JS::Value*) /build/firefox/src/dom/bindings/BindingUtils.cpp:2778:13 #8 0x7fbee7d8a305 in CallJSNative /build/firefox/src/js/src/jscntxtinlines.h:235:15 #9 0x7fbee7d8a305 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /build/firefox/src/js/src/vm/Interpreter.cpp:468 #10 0x7fbee7d7302c in CallFromStack /build/firefox/src/js/src/vm/Interpreter.cpp:531:12 #11 0x7fbee7d7302c in Interpret(JSContext*, js::RunState&) /build/firefox/src/js/src/vm/Interpreter.cpp:2831 #12 0x7fbee7d57586 in js::RunScript(JSContext*, js::RunState&) /build/firefox/src/js/src/vm/Interpreter.cpp:426:12 #13 0x7fbee7d8c4c8 in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value const&, js::AbstractFramePtr, JS::Value*) /build/firefox/src/js/src/vm/Interpreter.cpp:704:15 #14 0x7fbee7711d1b in EvalKernel(JSContext*, JS::HandleJS::Value, EvalType, js::AbstractFramePtr, JS::Handle<JSObject*>, unsigned char*, JS::MutableHandleJS::Value) /build/firefox/src/js/src/builtin/Eval.cpp:327:12 #15 0x7fbee77128be in js::DirectEval(JSContext*, JS::HandleJS::Value, JS::MutableHandleJS::Value) /build/firefox/src/js/src/builtin/Eval.cpp:439:12 #16 0x7fbee7d61e13 in Interpret(JSContext*, js::RunState&) /build/firefox/src/js/src/vm/Interpreter.cpp:2746:14 #17 0x7fbee7d57586 in js::RunScript(JSContext*, js::RunState&) /build/firefox/src/js/src/vm/Interpreter.cpp:426:12 #18 0x7fbee7d8a51b in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /build/firefox/src/js/src/vm/Interpreter.cpp:498:15 #19 0x7fbee7d3d581 in js::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, js::AnyInvokeArgs const&, JS::MutableHandleJS::Value) /build/firefox/src/js/src/vm/Interpreter.cpp:544:10 #20 0x7fbee78aee40 in JS::Call(JSContext*, JS::HandleJS::Value, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /build/firefox/src/js/src/jsapi.cpp:2919:12 #21 0x7fbee1a04ba9 in mozilla::dom::Function::Call(JSContext*, JS::HandleJS::Value, nsTArrayJS::Value const&, JS::MutableHandleJS::Value, mozilla::ErrorResult&) /build/firefox/src/objdir-ff-asan/dom/bindings/FunctionBinding.cpp:36:8 #22 0x7fbedfd2b806 in Call<nsCOMPtr<nsISupports> > /build/firefox/src/objdir-ff-asan/dist/include/mozilla/dom/FunctionBinding.h:64:12 #23 0x7fbedfd2b806 in nsGlobalWindow::RunTimeoutHandler(nsTimeout*, nsIScriptContext*) /build/firefox/src/dom/base/nsGlobalWindow.cpp:11961 #24 0x7fbedfd09f7b in nsGlobalWindow::RunTimeout(nsTimeout*) /build/firefox/src/dom/base/nsGlobalWindow.cpp:12210:32 #25 0x7fbedfca8281 in nsGlobalWindow::TimerCallback(nsITimer*, void*) /build/firefox/src/dom/base/nsGlobalWindow.cpp:12456:3 #26 0x7fbedd3b0345 in nsTimerImpl::Fire() /build/firefox/src/xpcom/threads/nsTimerImpl.cpp:524:7 #27 0x7fbedd3881fc in nsTimerEvent::Run() /build/firefox/src/xpcom/threads/TimerThread.cpp:286:3 #28 0x7fbedd394b35 in nsThread::ProcessNextEvent(bool, bool*) /build/firefox/src/xpcom/threads/nsThread.cpp:994:7 #29 0x7fbedd414b8c in NS_ProcessNextEvent(nsIThread*, bool) /build/firefox/src/xpcom/glue/nsThreadUtils.cpp:290:10 #30 0x7fbede16472f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /build/firefox/src/ipc/glue/MessagePump.cpp:98:21 #31 0x7fbede0daa71 in RunInternal /build/firefox/src/ipc/chromium/src/base/message_loop.cc:230:3 #32 0x7fbede0daa71 in RunHandler /build/firefox/src/ipc/chromium/src/base/message_loop.cc:223 #33 0x7fbede0daa71 in MessageLoop::Run() /build/firefox/src/ipc/chromium/src/base/message_loop.cc:203 #34 0x7fbee394ebff in nsBaseAppShell::Run() /build/firefox/src/widget/nsBaseAppShell.cpp:156:3 #35 0x7fbee5a52053 in XRE_RunAppShell /build/firefox/src/toolkit/xre/nsEmbedFunctions.cpp:801:12

SUMMARY: AddressSanitizer: heap-use-after-free (/build/firefox/src/objdir-ff-asan/dist/bin/libxul.so+0x6f13087) Shadow bytes around the buggy address: 0x0c10800fb1e0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd 0x0c10800fb1f0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa 0x0c10800fb200: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa 0x0c10800fb210: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa 0x0c10800fb220: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa =>0x0c10800fb230: fa fa fa fa fd fd fd fd fd fd fd fd fd[fd]fd fa 0x0c10800fb240: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa 0x0c10800fb250: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa 0x0c10800fb260: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa 0x0c10800fb270: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd 0x0c10800fb280: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==7931==ABORTING

The original report as published on Mozilla's Bugzilla, by Abhishek Arya. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A high-severity memory corruption bug in Audio/Video: MediaStreamGraph. Mozilla made it public on 10 May 2016.

About Memory corruption

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Abhishek Arya

View all

130 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.