Closed Bug 1539303 Opened 6 years ago Closed 6 years ago

AddressSanitizer: use-after-poison /builds/worker/workspace/build/src/layout/generic/nsQueryFrame.h:119:45 in operator nsIScrollableFrame *<nsIScrollableFrame>

Categories

(Core :: Layout, defect, P5)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1539017
Tracking Status
firefox-esr60 --- unaffected
firefox66 --- unaffected
firefox67 --- unaffected
firefox68 --- fixed

People

(Reporter: jkratzer, Unassigned)

References

(Blocks 1 open bug)

Details

(4 keywords)

Attachments

(1 file)

Attached file testcase.html

Testcase found while fuzzing mozilla-central rev 4572f6055a6a.

==24131==ERROR: AddressSanitizer: use-after-poison on address 0x6250002887c8 at pc 0x7ffb134a95f5 bp 0x7ffce59a9cd0 sp 0x7ffce59a9cc8
READ of size 8 at 0x6250002887c8 thread T0 (file:// Content)
    #0 0x7ffb134a95f4 in operator nsIScrollableFrame *<nsIScrollableFrame> /builds/worker/workspace/build/src/layout/generic/nsQueryFrame.h:119:45
    #1 0x7ffb134a95f4 in nsLayoutUtils::GetNearestScrollableFrame(nsIFrame*, unsigned int) /builds/worker/workspace/build/src/layout/base/nsLayoutUtils.cpp:1952
    #2 0x7ffb135b5d64 in mozilla::layout::ScrollAnchorContainer::FindFor(nsIFrame*) /builds/worker/workspace/build/src/layout/generic/ScrollAnchorContainer.cpp:37:33
    #3 0x7ffb136f6712 in IsScrollAnchor /builds/worker/workspace/build/src/layout/generic/nsFrame.cpp:9384:38
    #4 0x7ffb136f6712 in nsFrame::DestroyFrom(nsIFrame*, mozilla::layout::PostFrameDestroyData&) /builds/worker/workspace/build/src/layout/generic/nsFrame.cpp:789
    #5 0x7ffb1364e797 in nsBulletFrame::DestroyFrom(nsIFrame*, mozilla::layout::PostFrameDestroyData&) /builds/worker/workspace/build/src/layout/generic/nsBulletFrame.cpp:88:12
    #6 0x7ffb135f36bc in SafelyDestroyFrameListProp /builds/worker/workspace/build/src/layout/generic/nsContainerFrame.cpp:192:14
    #7 0x7ffb135f36bc in nsBlockFrame::DestroyFrom(nsIFrame*, mozilla::layout::PostFrameDestroyData&) /builds/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:350
    #8 0x7ffb138bfe0d in nsLineBox::DeleteLineList(nsPresContext*, nsLineList&, nsIFrame*, nsFrameList*, mozilla::layout::PostFrameDestroyData&) /builds/worker/workspace/build/src/layout/generic/nsLineBox.cpp:371:14
    #9 0x7ffb135f30ba in nsBlockFrame::DestroyFrom(nsIFrame*, mozilla::layout::PostFrameDestroyData&) /builds/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:326:3
    #10 0x7ffb1363ac72 in nsBlockFrame::DoRemoveFrameInternal(nsIFrame*, unsigned int, mozilla::layout::PostFrameDestroyData&) /builds/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:5729:20
    #11 0x7ffb136354d4 in DoRemoveFrame /builds/worker/workspace/build/src/layout/generic/nsBlockFrame.h:520:5
    #12 0x7ffb136354d4 in nsBlockFrame::RemoveFrame(mozilla::layout::FrameChildListID, nsIFrame*) /builds/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:5107
    #13 0x7ffb134307e5 in RemoveFrame /builds/worker/workspace/build/src/layout/base/nsFrameManager.cpp:116:18
    #14 0x7ffb134307e5 in nsCSSFrameConstructor::ContentRemoved(nsIContent*, nsIContent*, nsCSSFrameConstructor::RemoveFlags) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:7720
    #15 0x7ffb1341575d in nsCSSFrameConstructor::RecreateFramesForContent(nsIContent*, nsCSSFrameConstructor::InsertionKind) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:8755:7
    #16 0x7ffb13393aa5 in mozilla::RestyleManager::ProcessRestyledFrames(nsStyleChangeList&) /builds/worker/workspace/build/src/layout/base/RestyleManager.cpp:1574:25
    #17 0x7ffb133a4ba3 in mozilla::RestyleManager::DoProcessPendingRestyles(mozilla::ServoTraversalFlags) /builds/worker/workspace/build/src/layout/base/RestyleManager.cpp:3101:9
    #18 0x7ffb13339359 in ProcessPendingRestyles /builds/worker/workspace/build/src/layout/base/RestyleManager.cpp:3173:3
    #19 0x7ffb13339359 in mozilla::PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush) /builds/worker/workspace/build/src/layout/base/PresShell.cpp:4122
    #20 0x7ffb0c8d6cb3 in FlushPendingNotifications /builds/worker/workspace/build/src/layout/base/nsIPresShell.h:580:5
    #21 0x7ffb0c8d6cb3 in mozilla::dom::Document::FlushPendingNotifications(mozilla::ChangesToFlush) /builds/worker/workspace/build/src/dom/base/Document.cpp:7103
    #22 0x7ffb1332e668 in nsIPresShell::ScrollContentIntoView(nsIContent*, nsIPresShell::ScrollAxis, nsIPresShell::ScrollAxis, unsigned int) /builds/worker/workspace/build/src/layout/base/PresShell.cpp:3420:16
    #23 0x7ffb0c931388 in ScrollIntoView /builds/worker/workspace/build/src/dom/base/Element.cpp:781:14
    #24 0x7ffb0c931388 in mozilla::dom::Element::ScrollIntoView(mozilla::dom::BooleanOrScrollIntoViewOptions const&) /builds/worker/workspace/build/src/dom/base/Element.cpp:723
    #25 0x7ffb0f48a90d in mozilla::dom::Element_Binding::scrollIntoView(JSContext*, JS::Handle<JSObject*>, mozilla::dom::Element*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/ElementBinding.cpp:2919:9
    #26 0x7ffb0fd182d1 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3144:13
    #27 0x7ffb17493a37 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:442:13
    #28 0x7ffb17493a37 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:534
    #29 0x7ffb1747be4a in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:593:10
    #30 0x7ffb1747be4a in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3075
    #31 0x7ffb1745de78 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:422:10
    #32 0x7ffb174943a6 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:562:13
    #33 0x7ffb17495ff2 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:605:8
    #34 0x7ffb1807b619 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2621:10
    #35 0x7ffb0f320f39 in mozilla::dom::EventListener::HandleEvent(JSContext*, JS::Handle<JS::Value>, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventListenerBinding.cpp:52:8
    #36 0x7ffb105917b2 in HandleEvent<mozilla::dom::EventTarget *> /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventListenerBinding.h:66:12
    #37 0x7ffb105917b2 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1038
    #38 0x7ffb10593de3 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1239:17
    #39 0x7ffb10573ea0 in HandleEvent /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/EventListenerManager.h:355:5
    #40 0x7ffb10573ea0 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:351
    #41 0x7ffb105720c8 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:553:16
    #42 0x7ffb10578d13 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:1048:11
    #43 0x7ffb10580aa6 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp
    #44 0x7ffb0cc5eb34 in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1024:17
    #45 0x7ffb0c56cd9c in nsContentUtils::DispatchEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, mozilla::Trusted, bool*, mozilla::ChromeOnlyDispatch) /builds/worker/workspace/build/src/dom/base/nsContentUtils.cpp:4063:28
    #46 0x7ffb0c56cb0e in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) /builds/worker/workspace/build/src/dom/base/nsContentUtils.cpp:4033:10
    #47 0x7ffb0c8b1e3a in mozilla::dom::Document::DispatchContentLoadedEvents() /builds/worker/workspace/build/src/dom/base/Document.cpp:4708:3
    #48 0x7ffb0c9b7b6b in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1122:12
    #49 0x7ffb0c9b7b6b in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1128
    #50 0x7ffb0c9b7b6b in mozilla::detail::RunnableMethodImpl<mozilla::dom::Document*, void (mozilla::dom::Document::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1174
    #51 0x7ffb0851ec65 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:295:32
    #52 0x7ffb0855e5e1 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1180:14
    #53 0x7ffb085669ed in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:482:10
    #54 0x7ffb0983d68f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:88:21
    #55 0x7ffb09713c5e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
    #56 0x7ffb09713c5e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
    #57 0x7ffb09713c5e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
    #58 0x7ffb12bc1eb3 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:137:27
    #59 0x7ffb171b2c7e in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:933:20
    #60 0x7ffb09713c5e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
    #61 0x7ffb09713c5e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
    #62 0x7ffb09713c5e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
    #63 0x7ffb171b1e0c in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:771:34
    #64 0x558f8d35f834 in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:56:28
    #65 0x558f8d35f834 in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:263
    #66 0x7ffb2be74b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #67 0x558f8d284ebc in _start (/home/forb1dden/builds/mc-asan/firefox+0x2debc)

0x6250002887c8 is located 3784 bytes inside of 8192-byte region [0x625000287900,0x625000289900)
allocated by thread T0 (file:// Content) here:
    #0 0x558f8d32cd63 in __interceptor_malloc /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
    #1 0x7ffb08508d8a in mozilla::ArenaAllocator<8192ul, 8ul>::AllocateChunk(unsigned long) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/ArenaAllocator.h:171:15
    #2 0x7ffb1351efa2 in InternalAllocate /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/ArenaAllocator.h:205:25
    #3 0x7ffb1351efa2 in Allocate /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/ArenaAllocator.h:67
    #4 0x7ffb1351efa2 in mozilla::ArenaAllocator<8192ul, 8ul>::Allocate(unsigned long) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/ArenaAllocator.h:71
    #5 0x7ffb135e0b2b in AllocateByFrameID /builds/worker/workspace/build/src/layout/base/nsPresArena.h:38:12
    #6 0x7ffb135e0b2b in AllocateFrame /builds/worker/workspace/build/src/layout/base/nsIPresShell.h:223
    #7 0x7ffb135e0b2b in operator new /builds/worker/workspace/build/src/layout/generic/ViewportFrame.cpp:33
    #8 0x7ffb135e0b2b in NS_NewViewportFrame(nsIPresShell*, mozilla::ComputedStyle*) /builds/worker/workspace/build/src/layout/generic/ViewportFrame.cpp:30
    #9 0x7ffb133f8d21 in nsCSSFrameConstructor::ConstructRootFrame() /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:2550:7
    #10 0x7ffb13315267 in mozilla::PresShell::Initialize() /builds/worker/workspace/build/src/layout/base/PresShell.cpp:1727:36
    #11 0x7ffb0cb4d23a in nsContentSink::StartLayout(bool) /builds/worker/workspace/build/src/dom/base/nsContentSink.cpp:1201:26
    #12 0x7ffb0b2a6a7d in nsHtml5TreeOpExecutor::StartLayout(bool*) /builds/worker/workspace/build/src/parser/html/nsHtml5TreeOpExecutor.cpp:666:18
    #13 0x7ffb0b2a0946 in nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor*, nsIContent**, bool*, bool*) /builds/worker/workspace/build/src/parser/html/nsHtml5TreeOperation.cpp:1115:17
    #14 0x7ffb0b29f237 in nsHtml5TreeOpExecutor::RunFlushLoop() /builds/worker/workspace/build/src/parser/html/nsHtml5TreeOpExecutor.cpp:483:19
    #15 0x7ffb0b2ab5e0 in nsHtml5ExecutorFlusher::Run() /builds/worker/workspace/build/src/parser/html/nsHtml5StreamParser.cpp:133:18
    #16 0x7ffb0851ec65 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:295:32
    #17 0x7ffb0855e5e1 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1180:14
    #18 0x7ffb085669ed in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:482:10
    #19 0x7ffb0983d68f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:88:21
    #20 0x7ffb09713c5e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
    #21 0x7ffb09713c5e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
    #22 0x7ffb09713c5e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
    #23 0x7ffb12bc1eb3 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:137:27
    #24 0x7ffb171b2c7e in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:933:20
    #25 0x7ffb09713c5e in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
    #26 0x7ffb09713c5e in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
    #27 0x7ffb09713c5e in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
    #28 0x7ffb171b1e0c in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:771:34

SUMMARY: AddressSanitizer: use-after-poison /builds/worker/workspace/build/src/layout/generic/nsQueryFrame.h:119:45 in operator nsIScrollableFrame *<nsIScrollableFrame>
Shadow bytes around the buggy address:
  0x0c4a800490a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a800490b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a800490c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a800490d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a800490e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c4a800490f0: 00 00 00 00 00 00 00 00 00[f7]f7 f7 f7 f7 f7 f7
  0x0c4a80049100: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0c4a80049110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a80049120: 00 00 00 00 00 00 00 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0c4a80049130: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0c4a80049140: f7 f7 f7 f7 00 00 00 00 00 00 00 00 00 00 00 00
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
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  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
  Shadow gap:              cc
==24131==ABORTING
Flags: in-testsuite?
Group: core-security → layout-core-security
Keywords: sec-low

This looks like the same underlying issue as bug 1539017:
accessing an ancestor frame when destroying a nsBulletFrame.
The testcase also has 'column-count' on the <li>.

Please n-i me if it wasn't fixed by that bug.

Priority: -- → P5
Flags: needinfo?(jkratzer)

I can confirm that this appears to have been fixed by bug 1539017.

Flags: needinfo?(jkratzer)

Should we just dupe this over? Also, is the testcase different enough from bug 1539017 to justify adding it as a crashtest?

Flags: needinfo?(mats)

Yeah, I was just about to. :)
I'll land the crashtest together with some other stuff in a bit...

Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(mats)
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: