Closed Bug 1626005 Opened 4 years ago Closed 4 years ago

AddressSanitizer: SEGV /builds/worker/checkouts/gecko/dom/base/Document.cpp in mozilla::dom::Document::GetScopeObject() const

Categories

(Core :: CSS Parsing and Computation, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla77
Tracking Status
firefox-esr68 --- unaffected
firefox75 --- unaffected
firefox76 --- wontfix
firefox77 --- verified

People

(Reporter: jkratzer, Assigned: nordzilla)

References

(Blocks 1 open bug)

Details

(Keywords: regression, testcase, Whiteboard: [bugmon:bisected,confirmed], [wptsync upstream])

Attachments

(2 files, 1 obsolete file)

Attached file testcase.html

Testcase found while fuzzing mozilla-central rev ef8f91e97c99.

==30760==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000740 (pc 0x7f40c6ad69ea bp 0x7ffe9e916270 sp 0x7ffe9e9161a0 T0)
==30760==The signal is caused by a READ memory access.
==30760==Hint: address points to the zero page.
    #0 0x7f40c6ad69e9 in mozilla::dom::Document::GetScopeObject() const /builds/worker/checkouts/gecko/dom/base/Document.cpp
    #1 0x7f40cb374406 in mozilla::StyleSheet::Replace(nsTSubstring<char> const&, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/layout/style/StyleSheet.cpp:668:57
    #2 0x7f40c7a44263 in replace /builds/worker/workspace/obj-build/dom/bindings/CSSStyleSheetBinding.cpp:703:60
    #3 0x7f40c7a44263 in mozilla::dom::CSSStyleSheet_Binding::replace_promiseWrapper(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/CSSStyleSheetBinding.cpp:717:13
    #4 0x7f40c87f2875 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ConvertExceptionsToPromises>(JSContext*, unsigned int, JS::Value*) /builds/worker/checkouts/gecko/dom/bindings/BindingUtils.cpp:3205:13
    #5 0x7f40ced1e1db in CallJSNative /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:477:13
    #6 0x7f40ced1e1db in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:569:12
    #7 0x7f40ced1fffa in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:632:10
    #8 0x7f40ced06a05 in CallFromStack /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:636:10
    #9 0x7f40ced06a05 in Interpret(JSContext*, js::RunState&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:3028:16
    #10 0x7f40cece998e in js::RunScript(JSContext*, js::RunState&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:449:10
    #11 0x7f40ced1e2bd in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:604:13
    #12 0x7f40ced1fffa in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:632:10
    #13 0x7f40ced202d6 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:649:8
    #14 0x7f40ceebec72 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /builds/worker/checkouts/gecko/js/src/jsapi.cpp:2798:10
    #15 0x7f40c83e7c06 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:54:8
    #16 0x7f40c8ec8ddd 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
    #17 0x7f40c8ec8804 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/checkouts/gecko/dom/events/EventListenerManager.cpp:1073:43
    #18 0x7f40c8ec9f07 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /builds/worker/checkouts/gecko/dom/events/EventListenerManager.cpp:1271:17
    #19 0x7f40c8eb7e4f in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /builds/worker/checkouts/gecko/dom/events/EventDispatcher.cpp:356:17
    #20 0x7f40c8eb640d in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/checkouts/gecko/dom/events/EventDispatcher.cpp:558:16
    #21 0x7f40c8ebab76 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /builds/worker/checkouts/gecko/dom/events/EventDispatcher.cpp:1055:11
    #22 0x7f40c8ebfaa9 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /builds/worker/checkouts/gecko/dom/events/EventDispatcher.cpp
    #23 0x7f40c6dfe73e in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/base/nsINode.cpp:1302:17
    #24 0x7f40c68625c7 in nsContentUtils::DispatchEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, mozilla::Trusted, bool*, mozilla::ChromeOnlyDispatch) /builds/worker/checkouts/gecko/dom/base/nsContentUtils.cpp:4052:28
    #25 0x7f40c6862303 in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) /builds/worker/checkouts/gecko/dom/base/nsContentUtils.cpp:4022:10
    #26 0x7f40c6b20a41 in mozilla::dom::Document::DispatchContentLoadedEvents() /builds/worker/checkouts/gecko/dom/base/Document.cpp:7266:3
    #27 0x7f40c6beebc4 in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1168:12
    #28 0x7f40c6beebc4 in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1174:12
    #29 0x7f40c6beebc4 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:1220:13
    #30 0x7f40c2c3f34d in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/checkouts/gecko/xpcom/threads/SchedulerGroup.cpp:282:20
    #31 0x7f40c2c731f0 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1220:14
    #32 0x7f40c2c7e01c in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:481:10
    #33 0x7f40c3f4416f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:87:21
    #34 0x7f40c3e36897 in RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:315:10
    #35 0x7f40c3e36897 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:308:3
    #36 0x7f40c3e36897 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:290:3
    #37 0x7f40caf6f628 in nsBaseAppShell::Run() /builds/worker/checkouts/gecko/widget/nsBaseAppShell.cpp:137:27
    #38 0x7f40ceac0bc6 in XRE_RunAppShell() /builds/worker/checkouts/gecko/toolkit/xre/nsEmbedFunctions.cpp:909:20
    #39 0x7f40c3e36897 in RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:315:10
    #40 0x7f40c3e36897 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:308:3
    #41 0x7f40c3e36897 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:290:3
    #42 0x7f40ceac027a in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/checkouts/gecko/toolkit/xre/nsEmbedFunctions.cpp:740:34
    #43 0x55982b3daa63 in content_process_main /builds/worker/checkouts/gecko/browser/app/../../ipc/contentproc/plugin-container.cpp:56:28
    #44 0x55982b3daa63 in main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:303:18
    #45 0x7f40e5c11b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /builds/worker/checkouts/gecko/dom/base/Document.cpp in mozilla::dom::Document::GetScopeObject() const
Flags: in-testsuite?
Blocks: 1520690
Flags: needinfo?(enordin)
Whiteboard: [bugmon:confirm] → [bugmon:bisected,confirmed]
Bugmon Analysis:
Verified bug as reproducible on mozilla-central 20200330155408-670a20bfd18a.
Failed to bisect testcase (Start build crashes!):
> Start: ef8f91e97c99d3013dbe78e24f8cb52765ca6262 (20200330094747)
> End: 670a20bfd18a2ced1db8fc9a3234ef218c202b26 (20200330155408)
> BuildFlags: BuildFlags(asan=True, tsan=False, debug=False, fuzzing=False, coverage=False, valgrind=False)
Assignee: nobody → enordin
Status: NEW → ASSIGNED
Flags: needinfo?(enordin)
Priority: -- → P2

Bugbug thinks this bug is a regression, but please revert this change in case of error.

Keywords: regression
Bugmon Analysis:
Attachment #9136870 - Attachment description: Bug 1626005 - Fix crash by finding alternate way to retrieve global object r=emilio → Bug 1626005 - Fix crash by finding alternate way to retrieve global object r=emilio,edgar,smaug
Attachment #9136870 - Attachment description: Bug 1626005 - Fix crash by finding alternate way to retrieve global object r=emilio,edgar,smaug → Bug 1626005 - Fix crash by finding alternate way to retrieve global object -- WIP
Attachment #9136870 - Attachment description: Bug 1626005 - Fix crash by finding alternate way to retrieve global object -- WIP → Bug 1626005 - Fix crash by finding alternate way to retrieve global object r=emilio
Depends on: 1629596
Attachment #9136870 - Attachment is obsolete: true
Attachment #9141395 - Attachment description: Bug 1626005 - Ensure disassociated sheets can still creat promises -- WIP → Bug 1626005 - Fix crash when non-constructed sheets call replace() r=emilio
Pushed by dluca@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/154c0057da33
Fix crash when non-constructed sheets call replace() r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/23237 for changes under testing/web-platform/tests
Whiteboard: [bugmon:bisected,confirmed] → [bugmon:bisected,confirmed], [wptsync upstream]
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Upstream PR merged by moz-wptsync-bot
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Status: RESOLVED → VERIFIED
Keywords: bugmon
Bugmon Analysis:
Verified bug as fixed on rev mozilla-central 20200428100141-a99c73301874.
Removing bugmon keyword as no further action possible.
Please review the bug and re-add the keyword for further analysis.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: