Open Bug 1791882 Opened 2 years ago Updated 8 months ago

Assertion failure: false (MOZ_ASSERT_UNREACHABLE: Must have a principal here), at /dom/canvas/CanvasUtils.cpp:248

Categories

(Core :: Graphics: Canvas2D, defect)

x86_64
Linux
defect

Tracking

()

People

(Reporter: jkratzer, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

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

Attachments

(1 file)

Testcase found while fuzzing mozilla-central rev 5ad292b847e4 (built with: --enable-debug --enable-fuzzing).

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build 5ad292b847e4 --debug --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.html
Assertion failure: false (MOZ_ASSERT_UNREACHABLE: Must have a principal here), at /dom/canvas/CanvasUtils.cpp:248

    ==2765545==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f279efab43e bp 0x7ffc3ca88140 sp 0x7ffc3ca88100 T2765545)
    ==2765545==The signal is caused by a WRITE memory access.
    ==2765545==Hint: address points to the zero page.
        #0 0x7f279efab43e in mozilla::CanvasUtils::DoDrawImageSecurityCheck(mozilla::dom::HTMLCanvasElement*, nsIPrincipal*, bool, bool) /dom/canvas/CanvasUtils.cpp:248:5
        #1 0x7f279ef9f074 in mozilla::dom::CanvasRenderingContext2D::DrawImage(mozilla::dom::HTMLImageElementOrSVGImageElementOrHTMLCanvasElementOrHTMLVideoElementOrOffscreenCanvasOrImageBitmap const&, double, double, double, double, double, double, double, double, unsigned char, mozilla::ErrorResult&) /dom/canvas/CanvasRenderingContext2D.cpp:4891:5
        #2 0x7f279e362aa2 in mozilla::dom::CanvasRenderingContext2D_Binding::drawImage(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/CanvasRenderingContext2DBinding.cpp:2739:28
        #3 0x7f279eea802c 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:3287:13
        #4 0x7f27a455354c in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:458:13
        #5 0x7f27a4552e71 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:546:12
        #6 0x7f27a454a1a8 in CallFromStack /js/src/vm/Interpreter.cpp:618:10
        #7 0x7f27a454a1a8 in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3374:16
        #8 0x7f27a454124d in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:430:13
        #9 0x7f27a4552d6d in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:578:13
        #10 0x7f27a45542ac 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:645:8
        #11 0x7f27a31d33fc in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /js/src/vm/CallAndConstruct.cpp:117:10
        #12 0x7f279eb9c299 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
        #13 0x7f279f45cb06 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:65:12
        #14 0x7f279f45c82d in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /dom/events/EventListenerManager.cpp:1310:43
        #15 0x7f279f45d4d7 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1506:17
        #16 0x7f279f452414 in HandleEvent /dom/events/EventListenerManager.h:395:5
        #17 0x7f279f452414 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:348:17
        #18 0x7f279f451962 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:550:16
        #19 0x7f279f454201 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1119:11
        #20 0x7f27a1101213 in nsDocumentViewer::LoadComplete(nsresult) /layout/base/nsDocumentViewer.cpp:1083:7
        #21 0x7f27a2762f7d in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) /docshell/base/nsDocShell.cpp:6436:20
        #22 0x7f27a27624e4 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /docshell/base/nsDocShell.cpp:5829:7
        #23 0x7f27a2763eb7 in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /docshell/base/nsDocShell.cpp
        #24 0x7f279cc352ec in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /uriloader/base/nsDocLoader.cpp:1380:3
        #25 0x7f279cc3482a in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /uriloader/base/nsDocLoader.cpp:978:14
        #26 0x7f279cc32ae1 in nsDocLoader::DocLoaderIsEmpty(bool, mozilla::Maybe<nsresult> const&) /uriloader/base/nsDocLoader.cpp:797:9
        #27 0x7f279cc33cc8 in nsDocLoader::OnStopRequest(nsIRequest*, nsresult) /uriloader/base/nsDocLoader.cpp:680:5
        #28 0x7f27a2796ed1 in nsDocShell::OnStopRequest(nsIRequest*, nsresult) /docshell/base/nsDocShell.cpp:13841:23
        #29 0x7f279bf3ecf0 in mozilla::net::nsLoadGroup::NotifyRemovalObservers(nsIRequest*, nsresult) /netwerk/base/nsLoadGroup.cpp:628:22
        #30 0x7f279bf40223 in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /netwerk/base/nsLoadGroup.cpp:532:10
        #31 0x7f279d7a70dd in mozilla::dom::Document::DoUnblockOnload() /dom/base/Document.cpp:11475:18
        #32 0x7f279d7721bf in mozilla::dom::Document::UnblockOnload(bool) /dom/base/Document.cpp:11413:9
        #33 0x7f279d78d6b4 in mozilla::dom::Document::DispatchContentLoadedEvents() /dom/base/Document.cpp:7949:3
        #34 0x7f279d842eeb in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1147:12
        #35 0x7f279d842eeb in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1153:12
        #36 0x7f279d842eeb 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:1200:13
        #37 0x7f279bd30232 in mozilla::SchedulerGroup::Runnable::Run() /xpcom/threads/SchedulerGroup.cpp:140:20
        #38 0x7f279bd6214e in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:538:16
        #39 0x7f279bd3a669 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:851:26
        #40 0x7f279bd391f3 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:683:15
        #41 0x7f279bd39463 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:461:36
        #42 0x7f279bd659f6 in operator() /xpcom/threads/TaskController.cpp:187:37
        #43 0x7f279bd659f6 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:531:5
        #44 0x7f279bd4f2bf in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1205:16
        #45 0x7f279bd558cd in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:465:10
        #46 0x7f279c9358a6 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:85:21
        #47 0x7f279c85af07 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:381:10
        #48 0x7f279c85ae12 in RunHandler /ipc/chromium/src/base/message_loop.cc:374:3
        #49 0x7f279c85ae12 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:356:3
        #50 0x7f27a0d17d68 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:150:27
        #51 0x7f27a2f0e38b in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:880:20
        #52 0x7f279c93679a in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:235:9
        #53 0x7f279c85af07 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:381:10
        #54 0x7f279c85ae12 in RunHandler /ipc/chromium/src/base/message_loop.cc:374:3
        #55 0x7f279c85ae12 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:356:3
        #56 0x7f27a2f0d8a3 in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:739:34
        #57 0x555b6865fb39 in content_process_main /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
        #58 0x555b6865fb39 in main /browser/app/nsBrowserApp.cpp:359:18
        #59 0x7f27b361cd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
        #60 0x7f27b361ce3f in __libc_start_main csu/../csu/libc-start.c:392:3
        #61 0x555b686358dc in _start (/home/jkratzer/builds/mc-debug/firefox-bin+0x168dc) (BuildId: 2ebac32fd3db8e6d90b518677cea9c50777fa56a)
    
    UndefinedBehaviorSanitizer can not provide additional info.
    SUMMARY: UndefinedBehaviorSanitizer: SEGV /dom/canvas/CanvasUtils.cpp:248:5 in mozilla::CanvasUtils::DoDrawImageSecurityCheck(mozilla::dom::HTMLCanvasElement*, nsIPrincipal*, bool, bool)
    ==2765545==ABORTING
Attached file Testcase

Bugmon Analysis
Verified bug as reproducible on mozilla-central 20220921214338-7c0a787fe65a.
The bug appears to have been introduced in the following build range:

Start: ace96dd0c98b4fdc647db54b073b81ae90878fa9 (20220222204959)
End: 021bb4f25c52c5096213ab9a3d1990049a5230a1 (20220222225547)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=ace96dd0c98b4fdc647db54b073b81ae90878fa9&tochange=021bb4f25c52c5096213ab9a3d1990049a5230a1

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

:aosmond, can you comment to the bug? It is related to OffscreenCanvas.

Flags: needinfo?(aosmond)
Severity: -- → S3

Bugmon was unable reproduce this issue.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Keywords: bugmon

A change to the Taskcluster build definitions over the weekend caused Bugmon to fail when reproducing issues. This issue has been corrected. Re-enabling bugmon.

Keywords: bugmon

Testcase crashes using the initial build (mozilla-central 20220921095211-5ad292b847e4) but not with tip (mozilla-central 20230826092830-ddc3d1e9268d.)

Unable to bisect testcase (Start build didn't crash!):

Start: 5ad292b847e44f0f00e351a05a7a4c4935db703a (20220921095211)
End: ddc3d1e9268d9abde51f1082490491f544286b16 (20230826092830)
BuildFlags: BuildFlags(asan=True, tsan=None, debug=None, fuzzing=None, coverage=None, valgrind=None, no_opt=None, fuzzilli=None, nyx=None)

Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Keywords: bugmon
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: