Closed Bug 1348303 Opened 8 years ago Closed 8 years ago

heap-use-after-free [@mozilla::dom::Selection::ScrollSelectionIntoViewEvent::Run]

Categories

(Core :: Layout, defect)

defect
Not set
critical

Tracking

()

RESOLVED DUPLICATE of bug 1348222

People

(Reporter: jkratzer, Unassigned)

References

(Blocks 1 open bug)

Details

(4 keywords)

Attachments

(1 file)

Attached file Testcase
A heap-use-after-free was found while fuzzing mozilla-central rev 20170316-39607304b774. The attached testcase requires the FuzzPriv extension which can be found at: https://www.squarefree.com/extensions/domFuzzLite3.xpi ================================================================= ==12315==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d00034b508 at pc 0x7f6a6ccb0d30 bp 0x7fff4636e980 sp 0x7fff4636e978 READ of size 8 at 0x60d00034b508 thread T0 #0 0x7f6a6ccb0d2f in assign_assuming_AddRef /home/worker/workspace/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:62:17 #1 0x7f6a6ccb0d2f in operator= /home/worker/workspace/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:166 #2 0x7f6a6ccb0d2f in Forget /home/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1195 #3 0x7f6a6ccb0d2f in mozilla::dom::Selection::ScrollSelectionIntoViewEvent::Run() /home/worker/workspace/build/src/layout/generic/nsSelection.cpp:6166 #4 0x7f6a66220b1c in nsThread::ProcessNextEvent(bool, bool*) /home/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1269:14 #5 0x7f6a6621d448 in NS_ProcessNextEvent(nsIThread*, bool) /home/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:389:10 #6 0x7f6a66fc59c1 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /home/worker/workspace/build/src/ipc/glue/MessagePump.cpp:96:21 #7 0x7f6a66f264f0 in RunInternal /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:238:10 #8 0x7f6a66f264f0 in RunHandler /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:231 #9 0x7f6a66f264f0 in MessageLoop::Run() /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:211 #10 0x7f6a6c18f23f in nsBaseAppShell::Run() /home/worker/workspace/build/src/widget/nsBaseAppShell.cpp:156:27 #11 0x7f6a6f608dc1 in nsAppStartup::Run() /home/worker/workspace/build/src/toolkit/components/startup/nsAppStartup.cpp:283:30 #12 0x7f6a6f7c92ca in XREMain::XRE_mainRun() /home/worker/workspace/build/src/toolkit/xre/nsAppRunner.cpp:4492:22 #13 0x7f6a6f7cad53 in XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) /home/worker/workspace/build/src/toolkit/xre/nsAppRunner.cpp:4670:8 #14 0x7f6a6f7cc0dc in XRE_main(int, char**, mozilla::BootstrapConfig const&) /home/worker/workspace/build/src/toolkit/xre/nsAppRunner.cpp:4761:21 #15 0x4eb2b3 in do_main /home/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:236:22 #16 0x4eb2b3 in main /home/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:307 #17 0x7f6a8133682f in __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:291 #18 0x41ce08 in _start (/mnt/moz/builds/asan/firefox+0x41ce08) 0x60d00034b508 is located 104 bytes inside of 136-byte region [0x60d00034b4a0,0x60d00034b528) freed by thread T0 here: #0 0x4bb33b in __interceptor_free /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:47:3 #1 0x7f6a660c8917 in SnowWhiteKiller::~SnowWhiteKiller() /home/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2664:25 #2 0x7f6a660c8517 in nsCycleCollector::FreeSnowWhite(bool) /home/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2839:3 #3 0x7f6a679f440e in AsyncFreeSnowWhite::Run() /home/worker/workspace/build/src/js/xpconnect/src/XPCJSContext.cpp:146:34 #4 0x7f6a66220b1c in nsThread::ProcessNextEvent(bool, bool*) /home/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1269:14 #5 0x7f6a6621d448 in NS_ProcessNextEvent(nsIThread*, bool) /home/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:389:10 #6 0x7f6a66fc59c1 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /home/worker/workspace/build/src/ipc/glue/MessagePump.cpp:96:21 #7 0x7f6a66f264f0 in RunInternal /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:238:10 #8 0x7f6a66f264f0 in RunHandler /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:231 #9 0x7f6a66f264f0 in MessageLoop::Run() /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:211 #10 0x7f6a6c18f23f in nsBaseAppShell::Run() /home/worker/workspace/build/src/widget/nsBaseAppShell.cpp:156:27 #11 0x7f6a6f608dc1 in nsAppStartup::Run() /home/worker/workspace/build/src/toolkit/components/startup/nsAppStartup.cpp:283:30 #12 0x7f6a6f7c92ca in XREMain::XRE_mainRun() /home/worker/workspace/build/src/toolkit/xre/nsAppRunner.cpp:4492:22 #13 0x7f6a6f7cad53 in XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) /home/worker/workspace/build/src/toolkit/xre/nsAppRunner.cpp:4670:8 #14 0x7f6a6f7cc0dc in XRE_main(int, char**, mozilla::BootstrapConfig const&) /home/worker/workspace/build/src/toolkit/xre/nsAppRunner.cpp:4761:21 #15 0x4eb2b3 in do_main /home/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:236:22 #16 0x4eb2b3 in main /home/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:307 #17 0x7f6a8133682f in __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:291 previously allocated by thread T0 here: #0 0x4bb68c in malloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64:3 #1 0x4ec64d in moz_xmalloc /home/worker/workspace/build/src/memory/mozalloc/mozalloc.cpp:83:17 #2 0x7f6a6cc80619 in operator new /home/worker/workspace/build/src/obj-firefox/dist/include/mozilla/mozalloc.h:194:12 #3 0x7f6a6cc80619 in nsFrameSelection::nsFrameSelection() /home/worker/workspace/build/src/layout/generic/nsSelection.cpp:539 #4 0x7f6a6ac88f87 in nsTextEditorState::BindToFrame(nsTextControlFrame*) /home/worker/workspace/build/src/dom/html/nsTextEditorState.cpp:1183:43 #5 0x7f6a6cd9b15f in nsTextControlFrame::CreateAnonymousContent(nsTArray<nsIAnonymousContentCreator::ContentInfo>&) /home/worker/workspace/build/src/layout/forms/nsTextControlFrame.cpp:337:26 #6 0x7f6a6c91b8a2 in nsCSSFrameConstructor::GetAnonymousContent(nsIContent*, nsIFrame*, nsTArray<nsIAnonymousContentCreator::ContentInfo>&) /home/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:4232:26 #7 0x7f6a6c90f67a in nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState&, nsIContent*, nsStyleContext*, nsContainerFrame*, bool, nsFrameItems&, bool, PendingBinding*, nsIFrame*) /home/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:10988:3 #8 0x7f6a6c9247c1 in nsCSSFrameConstructor::ConstructFrameFromItemInternal(nsCSSFrameConstructor::FrameConstructionItem&, nsFrameConstructorState&, nsContainerFrame*, nsFrameItems&) /home/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:4087:9 #9 0x7f6a6c92f2bf in nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState&, nsCSSFrameConstructor::FrameConstructionItemList::Iterator&, nsContainerFrame*, nsFrameItems&) /home/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:6229:3 #10 0x7f6a6c910416 in ConstructFramesFromItemList /home/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:10769:5 #11 0x7f6a6c910416 in nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState&, nsIContent*, nsStyleContext*, nsContainerFrame*, bool, nsFrameItems&, bool, PendingBinding*, nsIFrame*) /home/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:11073 #12 0x7f6a6c919353 in nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState&, nsIContent*, nsContainerFrame*, nsContainerFrame*, nsStyleContext*, nsContainerFrame**, nsFrameItems&, nsIFrame*, PendingBinding*) /home/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:12091:3 #13 0x7f6a6c9156da in nsCSSFrameConstructor::ConstructDocElementFrame(mozilla::dom::Element*, nsILayoutHistoryState*) /home/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:2643:5 #14 0x7f6a6c93892d in nsCSSFrameConstructor::ContentRangeInserted(nsIContent*, nsIContent*, nsIContent*, nsILayoutHistoryState*, bool, TreeMatchContext*) /home/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:7846:7 #15 0x7f6a6c9373f6 in nsCSSFrameConstructor::ContentInserted(nsIContent*, nsIContent*, nsILayoutHistoryState*, bool) /home/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:7731:10 #16 0x7f6a6c882332 in mozilla::PresShell::Initialize(int, int) /home/worker/workspace/build/src/layout/base/PresShell.cpp:1787:26 #17 0x7f6a68b1afa7 in nsContentSink::StartLayout(bool) /home/worker/workspace/build/src/dom/base/nsContentSink.cpp:1239:26 #18 0x7f6a68bd50bd in nsDocument::FlushPendingNotifications(mozilla::FlushType) /home/worker/workspace/build/src/dom/base/nsDocument.cpp:7963:13 #19 0x7f6a688011fd in nsContentUtils::FlushLayoutForTree(nsPIDOMWindowOuter*) /home/worker/workspace/build/src/dom/base/nsContentUtils.cpp:6503:10 #20 0x7f6a6a56f2d3 in mozilla::dom::CanvasRenderingContext2D::DrawWindow(nsGlobalWindow&, double, double, double, double, nsAString const&, unsigned int, mozilla::ErrorResult&) /home/worker/workspace/build/src/dom/canvas/CanvasRenderingContext2D.cpp:5234:5 #21 0x7f6a6995bbc2 in mozilla::dom::CanvasRenderingContext2DBinding::drawWindow(JSContext*, JS::Handle<JSObject*>, mozilla::dom::CanvasRenderingContext2D*, JSJitMethodCallArgs const&) /home/worker/workspace/build/src/obj-firefox/dom/bindings/CanvasRenderingContext2DBinding.cpp:2308:9 #22 0x7f6a6a47635e in mozilla::dom::GenericBindingMethod(JSContext*, unsigned int, JS::Value*) /home/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:2953:13 #23 0x7f6a6fc1c951 in CallJSNative /home/worker/workspace/build/src/js/src/jscntxtinlines.h:282:15 #24 0x7f6a6fc1c951 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /home/worker/workspace/build/src/js/src/vm/Interpreter.cpp:448 #25 0x7f6a6fc053c7 in CallFromStack /home/worker/workspace/build/src/js/src/vm/Interpreter.cpp:499:12 #26 0x7f6a6fc053c7 in Interpret(JSContext*, js::RunState&) /home/worker/workspace/build/src/js/src/vm/Interpreter.cpp:2954 #27 0x7f6a6fbebbbe in js::RunScript(JSContext*, js::RunState&) /home/worker/workspace/build/src/js/src/vm/Interpreter.cpp:394:12 #28 0x7f6a6fc1cad6 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /home/worker/workspace/build/src/js/src/vm/Interpreter.cpp:466:15 #29 0x7f6a6fc1d2e2 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) /home/worker/workspace/build/src/js/src/vm/Interpreter.cpp:512:10 #30 0x7f6a7058e7b3 in JS_CallFunctionValue(JSContext*, JS::Handle<JSObject*>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /home/worker/workspace/build/src/js/src/jsapi.cpp:2828:12 #31 0x7f6a67973b8b in xpc::FunctionForwarder(JSContext*, unsigned int, JS::Value*) /home/worker/workspace/build/src/js/xpconnect/src/ExportHelpers.cpp:319:18 #32 0x7f6a6fc1c951 in CallJSNative /home/worker/workspace/build/src/js/src/jscntxtinlines.h:282:15 #33 0x7f6a6fc1c951 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /home/worker/workspace/build/src/js/src/vm/Interpreter.cpp:448 #34 0x7f6a6fc053c7 in CallFromStack /home/worker/workspace/build/src/js/src/vm/Interpreter.cpp:499:12 #35 0x7f6a6fc053c7 in Interpret(JSContext*, js::RunState&) /home/worker/workspace/build/src/js/src/vm/Interpreter.cpp:2954 SUMMARY: AddressSanitizer: heap-use-after-free /home/worker/workspace/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:62:17 in assign_assuming_AddRef Shadow bytes around the buggy address: 0x0c1a80061650: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa 0x0c1a80061660: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c1a80061670: fd fa fa fa fa fa fa fa fa fa fd fd fd fd fd fd 0x0c1a80061680: fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa 0x0c1a80061690: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd =>0x0c1a800616a0: fd[fd]fd fd fd fa fa fa fa fa fa fa fa fa 00 00 0x0c1a800616b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa 0x0c1a800616c0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c1a800616d0: 00 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa 0x0c1a800616e0: fa fa fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c1a800616f0: fd fd fd fd fa fa fa fa fa fa fa fa fd fd fd fd 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 ==12315==ABORTING [Exit code: -6]
Flags: in-testsuite?
Group: core-security → layout-core-security
Keywords: sec-high
Thanks for your report. This bug was fixed in bug 1348222 (landed on mozilla-inbound). The fix should be merged to mozilla-central in the next day or so.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Group: layout-core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: