Closed Bug 1423216 Opened 3 years ago Closed 2 years ago

Null crash [@nsCSSFrameConstructor::IsValidSibling]

Categories

(Core :: Layout, defect, P3)

59 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox-esr52 --- unaffected
firefox-esr60 --- fixed
firefox60 --- fixed
firefox61 --- fixed
firefox62 --- fixed

People

(Reporter: jkratzer, Assigned: emilio)

References

(Blocks 1 open bug)

Details

(Keywords: crash, testcase)

Attachments

(2 files)

Attached file trigger.html
Testcase found while fuzzing mozilla-central rev b4cef8d1dff0.

==2957==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f03e9618d1d bp 0x7ffee131e5a0 sp 0x7ffee131e480 T0)
==2957==The signal is caused by a READ memory access.
==2957==Hint: address points to the zero page.
    #0 0x7f03e9618d1c in nsCSSFrameConstructor::IsValidSibling(nsIFrame*, nsIContent*, mozilla::StyleDisplay&) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:6745:21
    #1 0x7f03e961967e in nsCSSFrameConstructor::AdjustSiblingFrame(nsIFrame*, nsIContent*, mozilla::StyleDisplay&, nsCSSFrameConstructor::SiblingDirection) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:6901:8
    #2 0x7f03e96f1305 in operator() /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:6821:12
    #3 0x7f03e96f1305 in nsIFrame* nsCSSFrameConstructor::FindSiblingInternal<(nsCSSFrameConstructor::SiblingDirection)1>(mozilla::dom::FlattenedChildIterator, nsIContent*, mozilla::StyleDisplay&) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:6848
    #4 0x7f03e9619d23 in nsIFrame* nsCSSFrameConstructor::FindSibling<(nsCSSFrameConstructor::SiblingDirection)1>(mozilla::dom::FlattenedChildIterator const&, mozilla::StyleDisplay&) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:6929:5
    #5 0x7f03e961b145 in FindPreviousSibling /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:6912:10
    #6 0x7f03e961b145 in nsCSSFrameConstructor::GetInsertionPrevSibling(nsCSSFrameConstructor::InsertionPoint*, nsIContent*, bool*, bool*, nsIContent*, nsIContent*) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:7015
    #7 0x7f03e961da03 in nsCSSFrameConstructor::ContentRangeInserted(nsIContent*, nsIContent*, nsIContent*, nsILayoutHistoryState*, nsCSSFrameConstructor::InsertionKind, TreeMatchContext*) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:8107:27
    #8 0x7f03e961bd82 in nsCSSFrameConstructor::ContentInserted(nsIContent*, nsIContent*, nsILayoutHistoryState*, nsCSSFrameConstructor::InsertionKind) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:7896:3
    #9 0x7f03e95717a8 in mozilla::PresShell::ContentInserted(nsIDocument*, nsIContent*, nsIContent*) /builds/worker/workspace/build/src/layout/base/PresShell.cpp:4491:22
    #10 0x7f03e4dc3692 in nsNodeUtils::ContentInserted(nsINode*, nsIContent*) /builds/worker/workspace/build/src/dom/base/nsNodeUtils.cpp:198:3
    #11 0x7f03e4d6b655 in nsINode::doInsertChildAt(nsIContent*, unsigned int, bool, nsAttrAndChildArray&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1646:7
    #12 0x7f03e4d71bdf in nsINode::ReplaceOrInsertBefore(bool, nsINode*, nsINode*, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:2533:14
    #13 0x7f03e4e060de in InsertBefore /builds/worker/workspace/build/src/dom/base/nsINode.h:1856:12
    #14 0x7f03e4e060de in nsRange::InsertNode(nsINode&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsRange.cpp:2983
    #15 0x7f03e59ad188 in mozilla::dom::RangeBinding::insertNode(JSContext*, JS::Handle<JSObject*>, nsRange*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/RangeBinding.cpp:1048:9
    #16 0x7f03e6ca1c97 in mozilla::dom::GenericBindingMethod(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3042:13
    #17 0x7f03ed7430d1 in CallJSNative /builds/worker/workspace/build/src/js/src/jscntxtinlines.h:291:15
    #18 0x7f03ed7430d1 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:473
    #19 0x7f03ed729138 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:528:12
    #20 0x7f03ed729138 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3096
    #21 0x7f03ed7158a0 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:423:12
    #22 0x7f03ed74355e in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:495:15
    #23 0x7f03ed744062 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:541:10
    #24 0x7f03ee23d49c 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:3036:12
    #25 0x7f03e65f8e7e in mozilla::dom::EventHandlerNonNull::Call(JSContext*, JS::Handle<JS::Value>, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventHandlerBinding.cpp:260:37
    #26 0x7f03e714bf23 in Call<nsISupports *> /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventHandlerBinding.h:362:12
    #27 0x7f03e714bf23 in mozilla::JSEventHandler::HandleEvent(nsIDOMEvent*) /builds/worker/workspace/build/src/dom/events/JSEventHandler.cpp:215
    #28 0x7f03e71129e1 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, nsIDOMEvent*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1111:51
    #29 0x7f03e71148f2 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, nsIDOMEvent**, mozilla::dom::EventTarget*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1286:20
    #30 0x7f03e70ff2df in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:462:16
    #31 0x7f03e7102bcb in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, nsIDOMEvent*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:826:9
    #32 0x7f03e9659231 in nsDocumentViewer::LoadComplete(nsresult) /builds/worker/workspace/build/src/layout/base/nsDocumentViewer.cpp:1070:7
    #33 0x7f03ec9c4c62 in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:7875:21
    #34 0x7f03ec9c0b8a in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:7668:7
    #35 0x7f03ec9c898f in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp
    #36 0x7f03e39c7607 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:1319:3
    #37 0x7f03e39c6811 in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:862:14
    #38 0x7f03e39c34a4 in nsDocLoader::DocLoaderIsEmpty(bool) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:751:9
    #39 0x7f03e39c54dc in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:633:5
    #40 0x7f03e39c63fc in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp
    #41 0x7f03e1ce856a in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/netwerk/base/nsLoadGroup.cpp:629:28
    #42 0x7f03e4c94247 in DoUnblockOnload /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:9116:18
    #43 0x7f03e4c94247 in nsDocument::UnblockOnload(bool) /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:9038
    #44 0x7f03e4c703da in nsDocument::DispatchContentLoadedEvents() /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:5678:3
    #45 0x7f03e4cefc44 in applyImpl<nsDocument, void (nsDocument::*)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1142:12
    #46 0x7f03e4cefc44 in apply<nsDocument, void (nsDocument::*)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1148
    #47 0x7f03e4cefc44 in mozilla::detail::RunnableMethodImpl<nsDocument*, void (nsDocument::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1192
    #48 0x7f03e1b01004 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:396:25
    #49 0x7f03e1b278de in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1033:14
    #50 0x7f03e1b43660 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:508:10
    #51 0x7f03e29b5c0a in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:97:21
    #52 0x7f03e290cb99 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:326:10
    #53 0x7f03e290cb99 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:319
    #54 0x7f03e290cb99 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:299
    #55 0x7f03e8d5edca in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:157:27
    #56 0x7f03ed47621b in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:865:22
    #57 0x7f03e290cb99 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:326:10
    #58 0x7f03e290cb99 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:319
    #59 0x7f03e290cb99 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:299
    #60 0x7f03ed475c0d in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:691:34
    #61 0x4ee9f5 in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:63:30
    #62 0x4ee9f5 in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:280
    #63 0x7f04009b182f in __libc_start_main /build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:291
Flags: in-testsuite?
Version: 52 Branch → 59 Branch
Priority: -- → P3
Attached file Testcase #2
The original test is createShadowRoot() which has been removed:
TypeError: o2.createShadowRoot is not a function

Replacing it with attachShadow({ mode: "open" }) seems to work
fine.  It's not crashing or asserting for me anyway (on Linux).
s/is/uses/
This might have been fixed by emilio's work on nsCSSFrameConstructor.
If so, we should just land a crashtest and resolve it wfm.
Yeah, sounds likely. I'll double-check and land it.
Flags: needinfo?(emilio)
Yeah, probably fixed by bug 1425759.
Flags: needinfo?(emilio)
https://hg.mozilla.org/mozilla-central/rev/c58ec47c4b75
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Assignee: nobody → jkratzer
Flags: in-testsuite? → in-testsuite+
Assignee: jkratzer → emilio
Depends on: 1425759
Target Milestone: mozilla62 → mozilla60
You need to log in before you can comment on or make changes to this bug.