Heap-use-after-free in nsEditor::RemoveContainer
Originally disclosed on Mozilla
- Fixed in 19 hours
- Paid in 6 months
- Disclosed after 19 hours
Reproduces on trunk, testcase coming soon. 20120707214206 http://hg.mozilla.org/mozilla-central/rev/9533b40ff28b
================================================================= ==16543== ERROR: AddressSanitizer heap-use-after-free on address 0x7f846f5f0e80 at pc 0x7f84ad6660c3 bp 0x7fffd4173830 sp 0x7fffd4173828 READ of size 8 at 0x7f846f5f0e80 thread T0 #0 0x7f84ad6660c3 in nsEditor::RemoveContainer(nsINode*) src/editor/libeditor/base/nsEditor.cpp:1623 #1 0x7f84ad664a0c in nsEditor::RemoveContainer(nsIDOMNode*) src/editor/libeditor/base/nsEditor.cpp:1598 #2 0x7f84adbebc31 in nsHTMLEditor::RemoveBlockContainer(nsIDOMNode*) src/editor/libeditor/html/nsHTMLEditor.cpp:3931 #3 0x7f84add4480a in nsHTMLEditRules::PopListItem(nsIDOMNode*, bool*) src/editor/libeditor/html/nsHTMLEditRules.cpp:7951 #4 0x7f84add45c3e in nsHTMLEditRules::RemoveListStructure(nsIDOMNode*) src/editor/libeditor/html/nsHTMLEditRules.cpp:7975 #5 0x7f84adcdd6ba in nsHTMLEditRules::WillRemoveList(nsISelection*, bool, bool*, bool*) src/editor/libeditor/html/nsHTMLEditRules.cpp:3223 #6 0x7f84adc8edf3 in nsHTMLEditRules::WillDoAction(mozilla::Selection*, nsRulesInfo*, bool*, bool*) src/editor/libeditor/html/nsHTMLEditRules.cpp:595 #7 0x7f84adbb43b4 in nsHTMLEditor::RemoveList(nsAString_internal const&) src/editor/libeditor/html/nsHTMLEditor.cpp:2041 #8 0x7f84adbb4bef in non-virtual thunk to nsHTMLEditor::RemoveList(nsAString_internal const&) src/modules/zlib/src/inffast.c:0 #9 0x7f84b10e7d34 in nsListCommand::ToggleState(nsIEditor*) src/editor/composer/src/nsComposerCommands.cpp:298 #10 0x7f84b10de5a0 in nsBaseStateUpdatingCommand::DoCommand(char const*, nsISupports*) src/editor/composer/src/nsComposerCommands.cpp:87 #11 0x7f84b097d40d in nsControllerCommandTable::DoCommand(char const*, nsISupports*) src/embedding/components/commandhandler/src/nsControllerCommandTable.cpp:158 #12 0x7f84b094fd14 in nsBaseCommandController::DoCommand(char const*) src/embedding/components/commandhandler/src/nsBaseCommandController.cpp:137 #13 0x7f84b0968151 in nsCommandManager::DoCommand(char const*, nsICommandParams*, nsIDOMWindow*) src/embedding/components/commandhandler/src/nsCommandManager.cpp:238 #14 0x7f84abfb4a7a in nsHTMLDocument::ExecCommand(nsAString_internal const&, bool, nsAString_internal const&, bool*) src/content/html/document/src/nsHTMLDocument.cpp:3200 #15 0x7f84abfb73ee in non-virtual thunk to nsHTMLDocument::ExecCommand(nsAString_internal const&, bool, nsAString_internal const&, bool*) src/modules/zlib/src/inffast.c:0 #16 0x7f84b3d9fbfa in NS_InvokeByIndex_P src/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_unix.cpp:161 #17 0x7f84af51c56b in CallMethodHelper::Call() src/js/xpconnect/src/XPCWrappedNative.cpp:2405 #18 0x7f84af5837d4 in XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) src/js/xpconnect/src/XPCWrappedNativeJSOps.cpp:1474 #19 0x7f84b90c864d in js::CallJSNative(JSContext*, int ()(JSContext, unsigned int, JS::Value*), JS::CallArgs const&) src/js/src/jscntxtinlines.h:400 #20 0x7f84b903b268 in js::Interpret(JSContext*, js::StackFrame*, js::InterpMode) src/js/src/jsinterp.cpp:2465 #21 0x7f84b8fbf777 in js::RunScript(JSContext*, JSScript*, js::StackFrame*) src/js/src/jsinterp.cpp:299 #22 0x7f84b90d54bd in js::ExecuteKernel(JSContext*, JSScript*, JSObject&, JS::Value const&, js::ExecuteType, js::StackFrame*, JS::Value*) src/js/src/jsinterp.cpp:482 #23 0x7f84b90d71c0 in js::Execute(JSContext*, JSScript*, JSObject&, JS::Value*) src/js/src/jsinterp.cpp:519 #24 0x7f84b88fd011 in EvaluateUCScriptForPrincipalsCommon(JSContext*, JSObject*, JSPrincipals*, JSPrincipals*, unsigned short const*, unsigned int, char const*, unsigned int, JS::Value*, JSVersion) src/js/src/jsapi.cpp:5370 #25 0x7f84b88fef4c in JS_EvaluateUCScriptForPrincipalsVersionOrigin src/js/src/jsapi.cpp:5407 #26 0x7f84ac76174f in nsJSContext::EvaluateString(nsAString_internal const&, JSObject*, nsIPrincipal*, nsIPrincipal*, char const*, unsigned int, JSVersion, nsAString_internal*, bool*) src/dom/base/nsJSEnvironment.cpp:1466 #27 0x7f84ac910b5e in nsGlobalWindow::RunTimeoutHandler(nsTimeout*, nsIScriptContext*) src/dom/base/nsGlobalWindow.cpp:9519 #28 0x7f84ac8c5ee2 in nsGlobalWindow::RunTimeout(nsTimeout*) src/dom/base/nsGlobalWindow.cpp:9783 #29 0x7f84ac90ed6b in nsGlobalWindow::TimerCallback(nsITimer*, void*) src/dom/base/nsGlobalWindow.cpp:10055 #30 0x7f84b3cdaa42 in nsTimerImpl::Fire() src/xpcom/threads/nsTimerImpl.cpp:474 #31 0x7f84b3cdc67c in nsTimerEvent::Run() src/xpcom/threads/nsTimerImpl.cpp:558 #32 0x7f84b3c9eccd in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:625 #33 0x7f84b392e01d in NS_ProcessNextEvent_P(nsIThread*, bool) src/objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:217 #34 0x7f84b29cf81b in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:117 #35 0x7f84b3f5284a in MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:209 #36 0x7f84b3f52693 in MessageLoop::RunHandler() src/ipc/chromium/src/base/message_loop.cc:202 #37 0x7f84b3f52578 in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:176 #38 0x7f84b1f0742e in nsBaseAppShell::Run() src/widget/xpwidgets/nsBaseAppShell.cpp:165 #39 0x7f84b0b52668 in nsAppStartup::Run() src/toolkit/components/startup/nsAppStartup.cpp:257 #40 0x7f84a738f280 in XREMain::XRE_mainRun() src/toolkit/xre/nsAppRunner.cpp:3787 #41 0x7f84a7395c22 in XREMain::XRE_main(int, char**, nsXREAppData const*) src/toolkit/xre/nsAppRunner.cpp:3864 #42 0x7f84a73990f2 in XRE_main src/toolkit/xre/nsAppRunner.cpp:3940 #43 0x40c28f in do_main(int, char**) src/browser/app/nsBrowserApp.cpp:160 #44 0x409cbd in main src/browser/app/nsBrowserApp.cpp:330 #45 0x7f84c1fe1c4d in ?? ??:0 0x7f846f5f0e80 is located 0 bytes inside of 120-byte region [0x7f846f5f0e80,0x7f846f5f0ef8) freed by thread T0 here: #0 0x4a4392 in free ??:0 #1 0x7f84bee6f5c3 in moz_free src/memory/mozalloc/mozalloc.cpp:49 #2 0x7f84aaa8f9c6 in ~nsTextNode src/content/base/src/nsTextNode.cpp:121 #3 0x7f84aa96306d in nsNodeUtils::LastRelease(nsINode*) src/content/base/src/nsNodeUtils.cpp:252 #4 0x7f84aa7c8e7f in nsGenericDOMDataNode::Release() src/content/base/src/nsGenericDOMDataNode.cpp:113 #5 0x7f84aaa8fdf4 in nsTextNode::Release() src/content/base/src/nsTextNode.cpp:124 #6 0x7f84a7359250 in ~nsCOMPtr_base src/../../dist/include/nsCOMPtr.h:408 #7 0x7f84a8880cd6 in nsCOMPtr<nsIContent>::~nsCOMPtr() src/../../dist/include/nsCOMPtr.h:447 #8 0x7f84a88809a3 in nsCOMPtr<nsIContent>::~nsCOMPtr() src/../../dist/include/nsCOMPtr.h:447 #9 0x7f84adbd786b in nsHTMLEditor::DeleteNode(nsIDOMNode*) src/editor/libeditor/html/nsHTMLEditor.cpp:3227 #10 0x7f84ad6654ac in nsEditor::RemoveContainer(nsINode*) src/editor/libeditor/base/nsEditor.cpp:1620 #11 0x7f84ad664a0c in nsEditor::RemoveContainer(nsIDOMNode*) src/editor/libeditor/base/nsEditor.cpp:1598 #12 0x7f84adbebc31 in nsHTMLEditor::RemoveBlockContainer(nsIDOMNode*) src/editor/libeditor/html/nsHTMLEditor.cpp:3931 #13 0x7f84add4480a in nsHTMLEditRules::PopListItem(nsIDOMNode*, bool*) src/editor/libeditor/html/nsHTMLEditRules.cpp:7951 #14 0x7f84add45c3e in nsHTMLEditRules::RemoveListStructure(nsIDOMNode*) src/editor/libeditor/html/nsHTMLEditRules.cpp:7975 #15 0x7f84adcdd6ba in nsHTMLEditRules::WillRemoveList(nsISelection*, bool, bool*, bool*) src/editor/libeditor/html/nsHTMLEditRules.cpp:3223 #16 0x7f84adc8edf3 in nsHTMLEditRules::WillDoAction(mozilla::Selection*, nsRulesInfo*, bool*, bool*) src/editor/libeditor/html/nsHTMLEditRules.cpp:595 #17 0x7f84adbb43b4 in nsHTMLEditor::RemoveList(nsAString_internal const&) src/editor/libeditor/html/nsHTMLEditor.cpp:2041 #18 0x7f84adbb4bef in non-virtual thunk to nsHTMLEditor::RemoveList(nsAString_internal const&) src/modules/zlib/src/inffast.c:0 #19 0x7f84b10e7d34 in nsListCommand::ToggleState(nsIEditor*) src/editor/composer/src/nsComposerCommands.cpp:298 #20 0x7f84b10de5a0 in nsBaseStateUpdatingCommand::DoCommand(char const*, nsISupports*) src/editor/composer/src/nsComposerCommands.cpp:87 #21 0x7f84b097d40d in nsControllerCommandTable::DoCommand(char const*, nsISupports*) src/embedding/components/commandhandler/src/nsControllerCommandTable.cpp:158 #22 0x7f84b094fd14 in nsBaseCommandController::DoCommand(char const*) src/embedding/components/commandhandler/src/nsBaseCommandController.cpp:137 #23 0x7f84b0968151 in nsCommandManager::DoCommand(char const*, nsICommandParams*, nsIDOMWindow*) src/embedding/components/commandhandler/src/nsCommandManager.cpp:238 #24 0x7f84abfb4a7a in nsHTMLDocument::ExecCommand(nsAString_internal const&, bool, nsAString_internal const&, bool*) src/content/html/document/src/nsHTMLDocument.cpp:3200 #25 0x7f84abfb73ee in non-virtual thunk to nsHTMLDocument::ExecCommand(nsAString_internal const&, bool, nsAString_internal const&, bool*) src/modules/zlib/src/inffast.c:0 #26 0x7f84b3d9fbfa in NS_InvokeByIndex_P src/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_unix.cpp:161 #27 0x7f84af51c56b in CallMethodHelper::Call() src/js/xpconnect/src/XPCWrappedNative.cpp:2405 #28 0x7f84af5837d4 in XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) src/js/xpconnect/src/XPCWrappedNativeJSOps.cpp:1474 #29 0x7f84b90c864d in js::CallJSNative(JSContext*, int ()(JSContext, unsigned int, JS::Value*), JS::CallArgs const&) src/js/src/jscntxtinlines.h:400 previously allocated by thread T0 here: #0 0x4a4452 in __interceptor_malloc ??:0 #1 0x7f84bee6f717 in moz_xmalloc src/memory/mozalloc/mozalloc.cpp:54 #2 0x7f84aaa8ecf4 in NS_NewTextNode(nsIContent**, nsNodeInfoManager*) src/content/base/src/nsTextNode.cpp:102 #3 0x7f84ad9b65b1 in nsHtml5TreeOperation::AppendText(unsigned short const*, unsigned int, nsIContent*, nsHtml5TreeOpExecutor*) src/parser/html/nsHtml5TreeOperation.cpp:163 #4 0x7f84ad9bffcf in nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor*, nsIContent**) src/parser/html/nsHtml5TreeOperation.cpp:444 #5 0x7f84ad9e3021 in nsHtml5TreeOpExecutor::FlushDocumentWrite() src/parser/html/nsHtml5TreeOpExecutor.cpp:665 #6 0x7f84ada2e314 in nsHtml5StringParser::Tokenize(nsAString_internal const&, nsIDocument*, bool) src/parser/html/nsHtml5StringParser.cpp:128 #7 0x7f84ada2d485 in nsHtml5StringParser::ParseFragment(nsAString_internal const&, nsIContent*, nsIAtom*, int, bool, bool) src/parser/html/nsHtml5StringParser.cpp:66 #8 0x7f84aa41abe9 in nsContentUtils::ParseFragmentHTML(nsAString_internal const&, nsIContent*, nsIAtom*, int, bool, bool) src/content/base/src/nsContentUtils.cpp:4097 #9 0x7f84adb3cfbe in nsHTMLEditor::ParseFragment(nsAString_internal const&, nsIAtom*, nsIDocument*, nsCOMPtr<nsIDOMNode>, bool) src/editor/libeditor/html/nsHTMLDataTransfer.cpp:2338 #10 0x7f84adb0f47c in nsHTMLEditor::CreateDOMFragmentFromPaste(nsAString_internal const&, nsAString_internal const&, nsAString_internal const&, nsCOMPtr<nsIDOMNode>, nsCOMPtr<nsIDOMNode>, nsCOMPtr<nsIDOMNode>, int*, int*, bool) src/editor/libeditor/html/nsHTMLDataTransfer.cpp:2266 #11 0x7f84adb0296f in nsHTMLEditor::DoInsertHTMLWithContext(nsAString_internal const&, nsAString_internal const&, nsAString_internal const&, nsAString_internal const&, nsIDOMDocument*, nsIDOMNode*, int, bool, bool) src/editor/libeditor/html/nsHTMLDataTransfer.cpp:263 #12 0x7f84adb00ee3 in nsHTMLEditor::InsertHTMLWithContext(nsAString_internal const&, nsAString_internal const&, nsAString_internal const&, nsAString_internal const&, nsIDOMDocument*, nsIDOMNode*, int, bool) src/editor/libeditor/html/nsHTMLDataTransfer.cpp:229 #13 0x7f84adb0080d in nsHTMLEditor::InsertHTML(nsAString_internal const&) src/editor/libeditor/html/nsHTMLDataTransfer.cpp:214 #14 0x7f84adb008cf in non-virtual thunk to nsHTMLEditor::InsertHTML(nsAString_internal const&) src/modules/zlib/src/inffast.c:0 #15 0x7f84b110b233 in nsInsertHTMLCommand::DoCommandParams(char const*, nsICommandParams*, nsISupports*) src/editor/composer/src/nsComposerCommands.cpp:1329 #16 0x7f84b097dcbc in nsControllerCommandTable::DoCommandParams(char const*, nsICommandParams*, nsISupports*) src/embedding/components/commandhandler/src/nsControllerCommandTable.cpp:175 #17 0x7f84b095057f in nsBaseCommandController::DoCommandWithParams(char const*, nsICommandParams*) src/embedding/components/commandhandler/src/nsBaseCommandController.cpp:153 #18 0x7f84b09508b7 in non-virtual thunk to nsBaseCommandController::DoCommandWithParams(char const*, nsICommandParams*) src/modules/zlib/src/inffast.c:0 #19 0x7f84b0968061 in nsCommandManager::DoCommand(char const*, nsICommandParams*, nsIDOMWindow*) src/embedding/components/commandhandler/src/nsCommandManager.cpp:236 #20 0x7f84abfb52f4 in nsHTMLDocument::ExecCommand(nsAString_internal const&, bool, nsAString_internal const&, bool*) src/content/html/document/src/nsHTMLDocument.cpp:3218 #21 0x7f84abfb73ee in non-virtual thunk to nsHTMLDocument::ExecCommand(nsAString_internal const&, bool, nsAString_internal const&, bool*) src/modules/zlib/src/inffast.c:0 #22 0x7f84b3d9fbfa in NS_InvokeByIndex_P src/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_unix.cpp:161 #23 0x7f84af51c56b in CallMethodHelper::Call() src/js/xpconnect/src/XPCWrappedNative.cpp:2405 #24 0x7f84af5837d4 in XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) src/js/xpconnect/src/XPCWrappedNativeJSOps.cpp:1474 ==16543== ABORTING Stats: 422M malloced (457M for red zones) by 1184361 calls Stats: 259M realloced by 30667 calls Stats: 384M freed by 950492 calls Stats: 264M really freed by 551528 calls Stats: 608M (155739 full pages) mmaped in 152 calls mmaps by size class: 8:622554; 9:57337; 10:24570; 11:20470; 12:3072; 13:2560; 14:1792; 15:384; 16:640; 17:160; 18:320; 19:272; 20:16; mallocs by size class: 8:1069007; 9:60790; 10:24128; 11:19804; 12:3485; 13:2995; 14:1726; 15:434; 16:699; 17:318; 18:511; 19:451; 20:13; frees by size class: 8:855981; 9:48744; 10:20497; 11:16398; 12:2547; 13:2685; 14:1440; 15:375; 16:605; 17:299; 18:465; 19:446; 20:10; rfrees by size class: 8:462326; 9:46435; 10:19630; 11:15505; 12:2226; 13:2269; 14:1408; 15:356; 16:570; 17:232; 18:336; 19:225; 20:10; Stats: malloc large: 1293 small slow: 3831 Shadow byte and word: 0x1ff08debe1d0: fd 0x1ff08debe1d0: fd fd fd fd fd fd fd fd More shadow bytes: 0x1ff08debe1b0: fd fd fd fd fd fd fd fd 0x1ff08debe1b8: fd fd fd fd fd fd fd fd 0x1ff08debe1c0: fa fa fa fa fa fa fa fa 0x1ff08debe1c8: fa fa fa fa fa fa fa fa =>0x1ff08debe1d0: fd fd fd fd fd fd fd fd 0x1ff08debe1d8: fd fd fd fd fd fd fd fd 0x1ff08debe1e0: fa fa fa fa fa fa fa fa 0x1ff08debe1e8: fa fa fa fa fa fa fa fa 0x1ff08debe1f0: fd fd fd fd fd fd fd fd
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 9 July 2012.
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.