Closed Bug 1672856 Opened 4 years ago Closed 4 years ago

crash near null in [@ mozilla::dom::GetCorrespondingNodeInDocument]

Categories

(Core :: Print Preview, defect)

defect

Tracking

()

VERIFIED FIXED
84 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox82 --- unaffected
firefox83 --- wontfix
firefox84 --- verified

People

(Reporter: tsmith, Assigned: emilio)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: crash, regression, testcase)

Attachments

(2 files)

Attached file testcase.html

Testcase requires fuzzing build ac_add_options --enable-fuzzing.

==20652==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x7f26dccd72da bp 0x7fff708d43f0 sp 0x7fff708d42a0 T0)
==20652==The signal is caused by a READ memory access.
==20652==Hint: address points to the zero page.
    #0 0x7f26dccd72da in HasFlag /gecko/dom/base/nsWrapperCache.h:259:14
    #1 0x7f26dccd72da in IsInNativeAnonymousSubtree /gecko/dom/base/nsINode.h:1298:12
    #2 0x7f26dccd72da in mozilla::dom::GetCorrespondingNodeInDocument(nsINode const*, mozilla::dom::Document&) /gecko/dom/base/Document.cpp:12324:7
    #3 0x7f26dccd744e in operator() /gecko/dom/base/Document.cpp:12346:9
    #4 0x7f26dccd744e in mozilla::dom::GetCorrespondingNodeInDocument(nsINode const*, mozilla::dom::Document&) /gecko/dom/base/Document.cpp:12337:32
    #5 0x7f26dcc5462e in CachePrintSelectionRanges /gecko/dom/base/Document.cpp:12417:9
    #6 0x7f26dcc5462e in mozilla::dom::Document::CreateStaticClone(nsIDocShell*, nsIContentViewer*, bool*) /gecko/dom/base/Document.cpp:12515:3
    #7 0x7f26dca6d2ab in nsGlobalWindowOuter::Print(nsIPrintSettings*, nsIWebProgressListener*, nsIDocShell*, nsGlobalWindowOuter::IsPreview, nsGlobalWindowOuter::IsForWindowDotPrint, std::function<void (mozilla::dom::PrintPreviewResultInfo const&)>&&, mozilla::ErrorResult&) /gecko/dom/base/nsGlobalWindowOuter.cpp:5388:21
    #8 0x7f26dca13cab in nsGlobalWindowInner::PrintPreview(nsIPrintSettings*, nsIWebProgressListener*, nsIDocShell*, mozilla::ErrorResult&) /gecko/dom/base/nsGlobalWindowInner.cpp:3647:3
    #9 0x7f26de1c997e in mozilla::dom::Window_Binding::printPreview(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/WindowBinding.cpp:3209:59
    #10 0x7f26dea15898 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::MaybeCrossOriginObjectThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /gecko/dom/bindings/BindingUtils.cpp:3229:13
    #11 0x7f26e54a7d44 in CallJSNative /gecko/js/src/vm/Interpreter.cpp:506:13
    #12 0x7f26e54a7d44 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /gecko/js/src/vm/Interpreter.cpp:598:12
    #13 0x7f26e54aa11e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /gecko/js/src/vm/Interpreter.cpp:663:10
    #14 0x7f26e5490b16 in CallFromStack /gecko/js/src/vm/Interpreter.cpp:667:10
    #15 0x7f26e5490b16 in Interpret(JSContext*, js::RunState&) /gecko/js/src/vm/Interpreter.cpp:3336:16
    #16 0x7f26e5471576 in js::RunScript(JSContext*, js::RunState&) /gecko/js/src/vm/Interpreter.cpp:476:13
    #17 0x7f26e54a7f4c in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /gecko/js/src/vm/Interpreter.cpp:635:13
    #18 0x7f26e54aa11e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /gecko/js/src/vm/Interpreter.cpp:663:10
    #19 0x7f26e54aa4a0 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) /gecko/js/src/vm/Interpreter.cpp:680:8
    #20 0x7f26e5e217c2 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /gecko/js/src/jsapi.cpp:2829:10
    #21 0x7f26de60d848 in mozilla::dom::EventListener::HandleEvent(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/bindings/EventListenerBinding.cpp:57:8
    #22 0x7f26df188288 in void mozilla::dom::EventListener::HandleEvent<mozilla::dom::EventTarget*>(mozilla::dom::EventTarget* const&, mozilla::dom::Event&, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/obj-build/dist/include/mozilla/dom/EventListenerBinding.h:66:12
    #23 0x7f26df187ca4 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /gecko/dom/events/EventListenerManager.cpp:1073:43
    #24 0x7f26df1894f1 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /gecko/dom/events/EventListenerManager.cpp:1270:17
    #25 0x7f26df176f7e in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /gecko/dom/events/EventDispatcher.cpp:352:17
    #26 0x7f26df175783 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /gecko/dom/events/EventDispatcher.cpp:554:16
    #27 0x7f26df179bd9 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /gecko/dom/events/EventDispatcher.cpp:1092:11
    #28 0x7f26df17ef89 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /gecko/dom/events/EventDispatcher.cpp
    #29 0x7f26dcf1460f in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /gecko/dom/base/nsINode.cpp:1315:17
    #30 0x7f26dc96012f in nsContentUtils::DispatchEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, mozilla::Trusted, bool*, mozilla::ChromeOnlyDispatch) /gecko/dom/base/nsContentUtils.cpp:4072:28
    #31 0x7f26dc95fe73 in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) /gecko/dom/base/nsContentUtils.cpp:4042:10
    #32 0x7f26dcc1f3ce in mozilla::dom::Document::DispatchContentLoadedEvents() /gecko/dom/base/Document.cpp:7362:3
    #33 0x7f26dccf05cf in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1188:12
    #34 0x7f26dccf05cf in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1194:12
    #35 0x7f26dccf05cf in mozilla::detail::RunnableMethodImpl<mozilla::dom::Document*, void (mozilla::dom::Document::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1240:13
    #36 0x7f26d94fa6fd in mozilla::SchedulerGroup::Runnable::Run() /gecko/xpcom/threads/SchedulerGroup.cpp:146:20
    #37 0x7f26d95046b9 in mozilla::RunnableTask::Run() /gecko/xpcom/threads/TaskController.cpp:245:16
    #38 0x7f26d95011a7 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /gecko/xpcom/threads/TaskController.cpp:515:26
    #39 0x7f26d94ff047 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /gecko/xpcom/threads/TaskController.cpp:374:15
    #40 0x7f26d94ff49d in mozilla::TaskController::ProcessPendingMTTask(bool) /gecko/xpcom/threads/TaskController.cpp:171:36
    #41 0x7f26d950bf81 in operator() /gecko/xpcom/threads/TaskController.cpp:85:37
    #42 0x7f26d950bf81 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_3>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:577:5
    #43 0x7f26d952ba2b in nsThread::ProcessNextEvent(bool, bool*) /gecko/xpcom/threads/nsThread.cpp:1197:14
    #44 0x7f26d953672c in NS_ProcessNextEvent(nsIThread*, bool) /gecko/xpcom/threads/nsThreadUtils.cpp:513:10
    #45 0x7f26da80d8ef in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /gecko/ipc/glue/MessagePump.cpp:87:21
    #46 0x7f26da710d61 in RunInternal /gecko/ipc/chromium/src/base/message_loop.cc:334:10
    #47 0x7f26da710d61 in RunHandler /gecko/ipc/chromium/src/base/message_loop.cc:327:3
    #48 0x7f26da710d61 in MessageLoop::Run() /gecko/ipc/chromium/src/base/message_loop.cc:309:3
    #49 0x7f26e15173c7 in nsBaseAppShell::Run() /gecko/widget/nsBaseAppShell.cpp:137:27
    #50 0x7f26e52415cf in XRE_RunAppShell() /gecko/toolkit/xre/nsEmbedFunctions.cpp:913:20
    #51 0x7f26da710d61 in RunInternal /gecko/ipc/chromium/src/base/message_loop.cc:334:10
    #52 0x7f26da710d61 in RunHandler /gecko/ipc/chromium/src/base/message_loop.cc:327:3
    #53 0x7f26da710d61 in MessageLoop::Run() /gecko/ipc/chromium/src/base/message_loop.cc:309:3
    #54 0x7f26e5240b6c in XRE_InitChildProcess(int, char**, XREChildData const*) /gecko/toolkit/xre/nsEmbedFunctions.cpp:744:34
    #55 0x561e748cbd2d in content_process_main(mozilla::Bootstrap*, int, char**) /gecko/browser/app/../../ipc/contentproc/plugin-container.cpp:56:28
    #56 0x561e748cc167 in main /gecko/browser/app/nsBrowserApp.cpp:304:18
    #57 0x7f26f5d120b2 in __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:308:16
    #58 0x561e7481f6c9 in _start (/home/worker/builds/m-c-20201022145409-fuzzing-asan-opt/firefox+0x5a6c9)
Flags: in-testsuite?

A Pernosco session is available here: https://pernos.co/debug/HmTV8-C4VEMIL9qEdhpKyw/index.html

Assignee: nobody → emilio
Flags: needinfo?(emilio)
Flags: needinfo?(emilio)

In some edge cases involving shadow dom the selection code may get
confused and keep references to inside the shadow root (of <audio> in
this case).

Avoid crashing due to that in the printing code for now, bug.

Bug 1590379 tracks issues with selection handling inside shadow DOM.

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/315d9195557b
Don't crash when printing with selections pointing to detached nodes. r=jfkthame
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/26253 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
Upstream PR merged by moz-wptsync-bot

Bugmon Analysis:
Verified bug as fixed on rev mozilla-central 20201023214713-1980f87855fc.
Removing bugmon keyword as no further action possible.
Please review the bug and re-add the keyword for further analysis.

Status: RESOLVED → VERIFIED
Keywords: bugmon
Flags: in-testsuite? → in-testsuite+
Regressed by: 1670876
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: