Skip to content
Memory corruption Disclosed report

Global-buffer-overflow in nsTArray_Impl<mozilla::dom::OwningNonNull<nsINode>, nsTArrayInfallibleAllocator>::RemoveElementAt

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 39 hours
  • Paid in 2 months
  • Disclosed after 39 hours

Created attachment 8597756 Testcase

================================================================= ==36278==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7ff1ff3c2748 at pc 0x7ff1f7d64e6d bp 0x7ffe057d3980 sp 0x7ffe057d3978 READ of size 8 at 0x7ff1ff3c2748 thread T0 (Web Content) #0 0x7ff1f7d64e6c in ~nsRefPtr /build/firefox/src/objdir-ff-asan/editor/libeditor/../../dist/include/nsRefPtr.h:65:9 #1 0x7ff1f7d64e6c in ~OwningNonNull /build/firefox/src/editor/libeditor/nsEditorUtils.h:24 #2 0x7ff1f7d64e6c in Destruct /build/firefox/src/objdir-ff-asan/editor/libeditor/../../dist/include/nsTArray.h:518 #3 0x7ff1f7d64e6c in DestructRange /build/firefox/src/objdir-ff-asan/editor/libeditor/../../dist/include/nsTArray.h:1756 #4 0x7ff1f7d64e6c in RemoveElementsAt /build/firefox/src/objdir-ff-asan/editor/libeditor/../../dist/include/nsTArray.h:1449 #5 0x7ff1f7d64e6c in nsTArray_Impl<mozilla::dom::OwningNonNull<nsINode>, nsTArrayInfallibleAllocator>::RemoveElementAt(unsigned long) /build/firefox/src/objdir-ff-asan/editor/libeditor/../../dist/include/nsTArray.h:1455 #6 0x7ff1f7dafeac in nsHTMLEditRules::GetParagraphFormatNodes(nsTArray<mozilla::dom::OwningNonNull<nsINode> >&, nsHTMLEditRules::TouchContent) /build/firefox/src/editor/libeditor/nsHTMLEditRules.cpp:6047:7 #7 0x7ff1f7dace1c in nsHTMLEditRules::GetParagraphState(bool*, nsAString_internal&) /build/firefox/src/editor/libeditor/nsHTMLEditRules.cpp:1057:18 #8 0x7ff1f7e1e69f in GetParagraphState /build/firefox/src/editor/libeditor/nsHTMLEditor.cpp:1690:10 #9 0x7ff1f7e1e69f in non-virtual thunk to nsHTMLEditor::GetParagraphState(bool*, nsAString_internal&) /build/firefox/src/editor/libeditor/nsHTMLEditor.cpp:1684 #10 0x7ff1f7edc7d0 in nsParagraphStateCommand::GetCurrentState(nsIEditor*, nsICommandParams*) /build/firefox/src/editor/composer/nsComposerCommands.cpp:635:17 #11 0x7ff1f7edc4de in nsMultiStateCommand::GetCommandStateParams(char const*, nsICommandParams*, nsISupports*) /build/firefox/src/editor/composer/nsComposerCommands.cpp:614:12 #12 0x7ff1f91173af in nsControllerCommandTable::GetCommandState(char const*, nsICommandParams*, nsISupports*) /build/firefox/src/embedding/components/commandhandler/nsControllerCommandTable.cpp:188:10 #13 0x7ff1f910d8f1 in GetCommandStateWithParams /build/firefox/src/embedding/components/commandhandler/nsBaseCommandController.cpp:168:10 #14 0x7ff1f910d8f1 in non-virtual thunk to nsBaseCommandController::GetCommandStateWithParams(char const*, nsICommandParams*) /build/firefox/src/embedding/components/commandhandler/nsBaseCommandController.cpp:156 #15 0x7ff1f91135be in nsCommandManager::GetCommandState(char const*, nsIDOMWindow*, nsICommandParams*) /build/firefox/src/embedding/components/commandhandler/nsCommandManager.cpp:213:10 #16 0x7ff1f6b74b99 in nsHTMLDocument::QueryCommandValue(nsAString_internal const&, nsAString_internal&, mozilla::ErrorResult&) /build/firefox/src/dom/html/nsHTMLDocument.cpp:3624:8 #17 0x7ff1f617701a in mozilla::dom::HTMLDocumentBinding::queryCommandValue(JSContext*, JS::Handle<JSObject*>, nsHTMLDocument*, JSJitMethodCallArgs const&) /build/firefox/src/objdir-ff-asan/dom/bindings/./HTMLDocumentBinding.cpp:1026:3 #18 0x7ff1f64d71da in mozilla::dom::GenericBindingMethod(JSContext*, unsigned int, JS::Value*) /build/firefox/src/dom/bindings/BindingUtils.cpp:2578:13 #19 0x7ff1faec25f0 in CallJSNative /build/firefox/src/js/src/jscntxtinlines.h:235:15 #20 0x7ff1faec25f0 in js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) /build/firefox/src/js/src/vm/Interpreter.cpp:720 #21 0x7ff1faf00c77 in Interpret(JSContext*, js::RunState&) /build/firefox/src/js/src/vm/Interpreter.cpp:2956:18 #22 0x7ff1faee44e4 in js::RunScript(JSContext*, js::RunState&) /build/firefox/src/js/src/vm/Interpreter.cpp:677:12 #23 0x7ff1faf15ca1 in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value const&, js::ExecuteType, js::AbstractFramePtr, JS::Value*) /build/firefox/src/js/src/vm/Interpreter.cpp:902:15 #24 0x7ff1faf1638b in js::Execute(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value*) /build/firefox/src/js/src/vm/Interpreter.cpp:941:12 #25 0x7ff1fba09285 in Evaluate(JSContext*, JS::Handle<JSObject*>, JS::ReadOnlyCompileOptions const&, JS::SourceBufferHolder&, JS::MutableHandleJS::Value) /build/firefox/src/js/src/jsapi.cpp:4231:19 #26 0x7ff1fba0a14a in Evaluate /build/firefox/src/js/src/jsapi.cpp:4258:12 #27 0x7ff1fba0a14a in JS::Evaluate(JSContext*, JS::AutoObjectVector&, JS::ReadOnlyCompileOptions const&, JS::SourceBufferHolder&, JS::MutableHandleJS::Value) /build/firefox/src/js/src/jsapi.cpp:4313 #28 0x7ff1f49490b7 in nsJSUtils::EvaluateString(JSContext*, JS::SourceBufferHolder&, JS::Handle<JSObject*>, JS::CompileOptions&, nsJSUtils::EvaluateOptions const&, JS::MutableHandleJS::Value, void**) /build/firefox/src/dom/base/nsJSUtils.cpp:265:12 #29 0x7ff1f494a3b2 in nsJSUtils::EvaluateString(JSContext*, JS::SourceBufferHolder&, JS::Handle<JSObject*>, JS::CompileOptions&, void**) /build/firefox/src/dom/base/nsJSUtils.cpp:337:10 #30 0x7ff1f49cdd75 in nsScriptLoader::EvaluateScript(nsScriptLoadRequest*, JS::SourceBufferHolder&, void**) /build/firefox/src/dom/base/nsScriptLoader.cpp:1150:10 #31 0x7ff1f49caecc in nsScriptLoader::ProcessRequest(nsScriptLoadRequest*, void**) /build/firefox/src/dom/base/nsScriptLoader.cpp:979:10 #32 0x7ff1f49ce7d4 in nsScriptLoader::ProcessPendingRequests() /build/firefox/src/dom/base/nsScriptLoader.cpp:1178:5 #33 0x7ff1f49d076e in nsScriptLoader::OnStreamComplete(nsIStreamLoader*, nsISupports*, nsresult, unsigned int, unsigned char const*) /build/firefox/src/dom/base/nsScriptLoader.cpp:1463:3 #34 0x7ff1f26c7644 in nsStreamLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /build/firefox/src/netwerk/base/nsStreamLoader.cpp:98:19 #35 0x7ff1f25f31b3 in nsBaseChannel::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /build/firefox/src/netwerk/base/nsBaseChannel.cpp:771:7 #36 0x7ff1f25f33cc in non-virtual thunk to nsBaseChannel::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /build/firefox/src/netwerk/base/nsBaseChannel.cpp:759:16 #37 0x7ff1f26355a2 in nsInputStreamPump::OnStateStop() /build/firefox/src/netwerk/base/nsInputStreamPump.cpp:721:9 #38 0x7ff1f26334bf in nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) /build/firefox/src/netwerk/base/nsInputStreamPump.cpp:440:25 #39 0x7ff1f244adb9 in nsInputStreamReadyEvent::Run() /build/firefox/src/xpcom/io/nsStreamUtils.cpp:91:9 #40 0x7ff1f248a7e5 in nsThread::ProcessNextEvent(bool, bool*) /build/firefox/src/xpcom/threads/nsThread.cpp:866:7 #41 0x7ff1f24e9b5c in NS_ProcessNextEvent(nsIThread*, bool) /build/firefox/src/xpcom/glue/nsThreadUtils.cpp:265:10 #42 0x7ff1f2d9d6ae in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /build/firefox/src/ipc/glue/MessagePump.cpp:99:21 #43 0x7ff1f2d27891 in RunInternal /build/firefox/src/ipc/chromium/src/base/message_loop.cc:233:3 #44 0x7ff1f2d27891 in RunHandler /build/firefox/src/ipc/chromium/src/base/message_loop.cc:226 #45 0x7ff1f2d27891 in MessageLoop::Run() /build/firefox/src/ipc/chromium/src/base/message_loop.cc:200 #46 0x7ff1f7ba487f in nsBaseAppShell::Run() /build/firefox/src/widget/nsBaseAppShell.cpp:165:3 #47 0x7ff1f982d263 in XRE_RunAppShell /build/firefox/src/toolkit/xre/nsEmbedFunctions.cpp:738:12 #48 0x7ff1f2d27891 in RunInternal /build/firefox/src/ipc/chromium/src/base/message_loop.cc:233:3 #49 0x7ff1f2d27891 in RunHandler /build/firefox/src/ipc/chromium/src/base/message_loop.cc:226 #50 0x7ff1f2d27891 in MessageLoop::Run() /build/firefox/src/ipc/chromium/src/base/message_loop.cc:200 #51 0x7ff1f982c7db in XRE_InitChildProcess /build/firefox/src/toolkit/xre/nsEmbedFunctions.cpp:575:7 #52 0x4db762 in content_process_main(int, char**) /build/firefox/src/ipc/app/../contentproc/plugin-container.cpp:236:19 #53 0x7ff1ef96aec4 in __libc_start_main #54 0x41cfb1 in _start

0x7ff1ff3c2748 is located 56 bytes to the left of global variable '(anonymous namespace)::sMasterList' defined in '/build/firefox/src/xpcom/build/IOInterposer.cpp:360:34' (0x7ff1ff3c2780) of size 8 0x7ff1ff3c2748 is located 0 bytes to the right of global variable 'nsTArrayHeader::sEmptyHdr' defined in '/build/firefox/src/xpcom/glue/nsTArray.cpp:13:32' (0x7ff1ff3c2740) of size 8 Shadow bytes around the buggy address: 0x0ffebfe70490: f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 0x0ffebfe704a0: f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 01 f9 f9 f9 0x0ffebfe704b0: f9 f9 f9 f9 02 f9 f9 f9 f9 f9 f9 f9 00 00 f9 f9 0x0ffebfe704c0: f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9 01 f9 f9 f9 0x0ffebfe704d0: f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 =>0x0ffebfe704e0: f9 f9 f9 f9 00 00 00 00 00[f9]f9 f9 f9 f9 f9 f9 0x0ffebfe704f0: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0ffebfe70500: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0ffebfe70510: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0ffebfe70520: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0ffebfe70530: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 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 ==36278==ABORTING [Parent 36166] WARNING: pipe error (51): Connection reset by peer: file /build/firefox/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 459

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 critical-severity memory corruption bug in DOM: Editor. Mozilla made it public on 28 April 2015.

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.