Closed Bug 2001160 Opened 2 months ago Closed 2 months ago

Crash [@ nsIGlobalObject::PrincipalOrNull]

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
147 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox145 --- wontfix
firefox146 --- fixed
firefox147 --- verified

People

(Reporter: jkratzer, Assigned: tnikkel)

References

(Blocks 1 open bug, Regression)

Details

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

Crash Data

Attachments

(3 files)

Testcase found while fuzzing mozilla-central rev caf560206ff2 (built with: --enable-address-sanitizer --enable-fuzzing).

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework pipx --upgrade
$ python -m pipx ensurepath
$ fuzzfetch --build caf560206ff2 --asan --fuzzing  -n firefox
$ grizzly-replay-bugzilla ./firefox/firefox <bugid>
[@ nsIGlobalObject::PrincipalOrNull]

    =================================================================
    ==2125812==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x70a5afe34ead bp 0x7ffef82a74f0 sp 0x7ffef82a74e0 T0)
    ==2125812==The signal is caused by a READ memory access.
    ==2125812==Hint: address points to the zero page.
        #0 0x70a5afe34ead in nsIGlobalObject::PrincipalOrNull() const /dom/base/nsIGlobalObject.cpp:84:22
        #1 0x70a5b1bb4b4f in mozilla::ImageExtractionResult(mozilla::dom::HTMLCanvasElement*, mozilla::dom::OffscreenCanvas*) /dom/canvas/ClientWebGLContext.cpp:3561:45
        #2 0x70a5b1bd0bfa in operator() /dom/canvas/ClientWebGLContext.cpp:5351:11
        #3 0x70a5b1bd0bfa in CallProcessor<(lambda at /dom/canvas/ClientWebGLContext.cpp:5337:28)> /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:596:12
        #4 0x70a5b1bd0bfa in ProcessFixedData<(lambda at /dom/canvas/ClientWebGLContext.cpp:5337:28)> /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:702:12
        #5 0x70a5b1bd0bfa in mozilla::ClientWebGLContext::ReadPixels(int, int, int, int, unsigned int, unsigned int, mozilla::dom::ArrayBufferView_base<&JS_GetArrayBufferViewType(JSObject*)> const&, unsigned int, mozilla::dom::CallerType, mozilla::ErrorResult&) const /dom/canvas/ClientWebGLContext.cpp:5337:11
        #6 0x70a5b0f0ceb5 in mozilla::ClientWebGLContext::ReadPixels(int, int, int, int, unsigned int, unsigned int, mozilla::dom::Nullable<mozilla::dom::ArrayBufferView_base<&JS_GetArrayBufferViewType(JSObject*)>> const&, mozilla::dom::CallerType, mozilla::ErrorResult&) const /dom/canvas/ClientWebGLContext.h:2224:5
        #7 0x70a5b0fac21b in mozilla::dom::WebGLRenderingContext_Binding::readPixels(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/./WebGLRenderingContextBinding.cpp:13732:24
        #8 0x70a5b1937c20 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /dom/bindings/BindingUtils.cpp:3306:13
        #9 0x70a5b8b8b49b in CallJSNative /js/src/vm/Interpreter.cpp:490:13
        #10 0x70a5b8b8b49b in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:586:12
        #11 0x70a5b8ba9e80 in InternalCall /js/src/vm/Interpreter.cpp:653:10
        #12 0x70a5b8ba9e80 in CallFromStack /js/src/vm/Interpreter.cpp:658:10
        #13 0x70a5b8ba9e80 in js::Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3272:16
        #14 0x70a5b8b8a269 in MaybeEnterInterpreterTrampoline /js/src/vm/Interpreter.cpp:384:10
        #15 0x70a5b8b8a269 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:460:13
        #16 0x70a5b8b8b611 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:618:13
        #17 0x70a5b8b8d324 in InternalCall /js/src/vm/Interpreter.cpp:653:10
        #18 0x70a5b8b8d324 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) /js/src/vm/Interpreter.cpp:685:8
        #19 0x70a5b8ccdb48 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /js/src/vm/CallAndConstruct.cpp:119:10
        #20 0x70a5b15be0f6 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:62:8
        #21 0x70a5b28370a7 in void mozilla::dom::EventListener::HandleEvent<mozilla::dom::EventTarget*>(mozilla::dom::EventTarget* const&, mozilla::dom::Event&, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObjectBase::ExceptionHandling, JS::Realm*) /builds/worker/workspace/obj-build/dist/include/mozilla/dom/EventListenerBinding.h:65:12
        #22 0x70a5b283678d in mozilla::EventListenerManager::HandleEventSingleListener(mozilla::EventListenerManager::Listener*, nsAtom*, mozilla::WidgetEvent*, mozilla::dom::Event*, mozilla::dom::EventTarget*, bool) /dom/events/EventListenerManager.cpp:1267:43
        #23 0x70a5b283881a in mozilla::EventListenerManager::HandleEventWithListenerArray(mozilla::EventListenerManager::ListenerArray*, nsAtom*, mozilla::EventMessage, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, bool) /dom/events/EventListenerManager.cpp:1579:12
        #24 0x70a5b2837749 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1484:35
        #25 0x70a5b2820c8a in HandleEvent /builds/worker/workspace/obj-build/dist/include/mozilla/EventListenerManager.h:465:5
        #26 0x70a5b2820c8a in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:364:17
        #27 0x70a5b281e71a in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:605:16
        #28 0x70a5b2825796 in mozilla::EventDispatcher::Dispatch(mozilla::dom::EventTarget*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1260:11
        #29 0x70a5b6f69c6a in nsDocumentViewer::LoadComplete(nsresult) /layout/base/nsDocumentViewer.cpp:1010:7
        #30 0x70a5b7867b37 in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) /docshell/base/nsDocShell.cpp:6432:13
        #31 0x70a5b7866ac2 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /docshell/base/nsDocShell.cpp:5754:7
        #32 0x70a5b7868f22 in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /docshell/base/nsDocShell.cpp:0:0
        #33 0x70a5ad55a545 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /uriloader/base/nsDocLoader.cpp:1514:3
        #34 0x70a5ad559325 in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /uriloader/base/nsDocLoader.cpp:1046:14
        #35 0x70a5ad555060 in nsDocLoader::DocLoaderIsEmpty(bool, mozilla::Maybe<nsresult> const&) /uriloader/base/nsDocLoader.cpp:841:9
        #36 0x70a5ad5582ee in nsDocLoader::OnStopRequest(nsIRequest*, nsresult) /uriloader/base/nsDocLoader.cpp:722:5
        #37 0x70a5b78b5a64 in nsDocShell::OnStopRequest(nsIRequest*, nsresult) /docshell/base/nsDocShell.cpp:14468:23
        #38 0x70a5abd111f0 in mozilla::net::nsLoadGroup::NotifyRemovalObservers(nsIRequest*, nsresult) /netwerk/base/nsLoadGroup.cpp:656:22
        #39 0x70a5abd13663 in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /netwerk/base/nsLoadGroup.cpp:540:10
        #40 0x70a5af9a8fbf in DoUnblockOnload /dom/base/Document.cpp:12507:18
        #41 0x70a5af9a8fbf in mozilla::dom::Document::UnblockOnload(bool) /dom/base/Document.cpp:12446:7
        #42 0x70a5af9dd704 in mozilla::dom::Document::DispatchContentLoadedEvents() /dom/base/Document.cpp:8752:3
        #43 0x70a5afb0eccf in operator()<> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1083:18
        #44 0x70a5afb0eccf in __invoke_impl<void, (lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1082:9)> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
        #45 0x70a5afb0eccf in __invoke<(lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1082:9)> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
        #46 0x70a5afb0eccf in __apply_impl<(lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1082:9), std::tuple<> &> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tuple:1740:14
        #47 0x70a5afb0eccf in apply<(lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1082:9), std::tuple<> &> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tuple:1751:14
        #48 0x70a5afb0eccf in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1081:12
        #49 0x70a5afb0eccf 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:1132:13
        #50 0x70a5ab90ed0a in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:705:16
        #51 0x70a5ab8fe98b in mozilla::TaskController::RunTask(mozilla::Task*) /xpcom/threads/TaskController.cpp:196:19
        #52 0x70a5ab905c8d in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:1325:20
        #53 0x70a5ab903768 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:1148:15
        #54 0x70a5ab903d86 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:641:36
        #55 0x70a5ab91e291 in operator() /xpcom/threads/TaskController.cpp:333:37
        #56 0x70a5ab91e291 in mozilla::detail::RunnableFunction<mozilla::TaskController::TaskController()::$_0>::Run() /xpcom/threads/nsThreadUtils.h:549:5
        #57 0x70a5ab93f71a in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1164:16
        #58 0x70a5ab94a5e8 in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:461:10
        #59 0x70a5ad07698e in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:85:21
        #60 0x70a5acf59624 in RunInternal /ipc/chromium/src/base/message_loop.cc:368:10
        #61 0x70a5acf59624 in RunHandler /ipc/chromium/src/base/message_loop.cc:361:3
        #62 0x70a5acf59624 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:343:3
        #63 0x70a5b6682736 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:152:27
        #64 0x70a5b686fd8b in nsAppShell::Run() /widget/gtk/nsAppShell.cpp:555:33
        #65 0x70a5b88d0c5d in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:656:20
        #66 0x70a5acf59624 in RunInternal /ipc/chromium/src/base/message_loop.cc:368:10
        #67 0x70a5acf59624 in RunHandler /ipc/chromium/src/base/message_loop.cc:361:3
        #68 0x70a5acf59624 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:343:3
        #69 0x70a5b88cfc16 in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:594:34
        #70 0x5e9852b0630a in main /browser/app/nsBrowserApp.cpp:465:22
        #71 0x74a5d082f1c9 in __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
        #72 0x74a5d082f28a in __libc_start_main ./csu/../csu/libc-start.c:360:3
        #73 0x5e9852a20428 in _start ??:0:0
    
    ==2125812==Register values:
    rax = 0x0000000000000000  rbx = 0x0000000000000000  rcx = 0x00000e6cb9f3efa2  rdx = 0x000074a5d0800000
    rdi = 0x0000000000000000  rsi = 0x00007265cf9e0080  rbp = 0x00007ffef82a74f0  rsp = 0x00007ffef82a74e0
     r8 = 0x00005e9853589000   r9 = 0x0000000000000030  r10 = 0x00000fffdf054e3c  r11 = 0x0000000000000000
    r12 = 0x00007285cf9e4880  r13 = 0x00000e36b9f593e2  r14 = 0x000070a56006c800  r15 = 0x000071b5cfac9ec0
    AddressSanitizer can not provide additional info.
    SUMMARY: AddressSanitizer: SEGV (/home/jkratzer/builds/m-c-20251119095727-fuzzing-asan-opt/libxul.so+0xaf9aead) (BuildId: 4e7e4cc5fbd4ec64e1e687099725c6f8b6faeb4f)
    ==2125812==ABORTING
Attached file Testcase
Attachment #9527783 - Attachment filename: testcase.html.undefined → testcase.html
Attachment #9527783 - Attachment mime type: text/plain → text/html

Verified bug as reproducible on mozilla-central 20251119215322-e4b3aaadb10a.
The bug appears to have been introduced in the following build range:

Start: 01c29e74cd81972651f3d276791b5102b5c1a8ca (20250923204525)
End: 522d27d2ad86127c277588c48c46f6a760c69a99 (20250923223205)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=01c29e74cd81972651f3d276791b5102b5c1a8ca&tochange=522d27d2ad86127c277588c48c46f6a760c69a99

Keywords: regression
Whiteboard: [bugmon:confirm] → [bugmon:bisected,confirmed]

Andrew or Timothy, any idea what's going on here that's failing around: https://searchfox.org/firefox-main/source/dom/canvas/ClientWebGLContext.cpp#3561

I am guessing aOffscreenCanvas->GetOwnerGlobal() is null?

Flags: needinfo?(tnikkel)
Flags: needinfo?(lsalzman)
Flags: needinfo?(aosmond)
Keywords: pernosco-wanted

Successfully recorded a pernosco session. A link to the pernosco session will be added here shortly.

A pernosco session for this bug can be found here.

Assignee: nobody → tnikkel
Status: NEW → ASSIGNED
Flags: needinfo?(tnikkel)
Flags: needinfo?(aosmond)
Pushed by tnikkel@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/4d376753552c https://hg.mozilla.org/integration/autoland/rev/1c8d31a07926 Null check aOffscreenCanvas's owner global in ImageExtractionResult. r=lsalzman,gfx-reviewers
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch

Verified bug as fixed on rev mozilla-central 20251129212903-fba782c1c5d5.
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

The patch landed in nightly and beta is affected.
:tnikkel, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(tnikkel)

firefox-beta Uplift Approval Request

  • User impact if declined: null pointer crash
  • Code covered by automated testing: no
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: null check
  • String changes made/needed: none
  • Is Android affected?: yes
Attachment #9530027 - Flags: approval-mozilla-beta?

Comment on attachment 9530027 [details]
Bug 2001160. Null check aOffscreenCanvas's owner global in ImageExtractionResult.

This was too late for the Fx146 beta cycle. Moving the uplift request to target release for a potential Fx146 ride-along.

Attachment #9530027 - Flags: approval-mozilla-beta? → approval-mozilla-release?
Flags: needinfo?(tnikkel)

Please nominate this for ESR140 uplift when you get a chance.

Flags: needinfo?(tnikkel)
Flags: needinfo?(tnikkel)

I picked the wrong bug for "regressed by"! I only realized when trying to do the uplift and not seeing the code to be patched in esr140. Oops!

Duplicate of this bug: 1991444

Comment on attachment 9530027 [details]
Bug 2001160. Null check aOffscreenCanvas's owner global in ImageExtractionResult.

Approved for 146.0.1

Attachment #9530027 - Flags: approval-mozilla-release? → approval-mozilla-release+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: