Closed Bug 1755702 Opened 2 years ago Closed 2 years ago

Crash [@ mozilla::dom::HTMLCanvasElement::ToDataURLImpl]

Categories

(Core :: Graphics: WebGPU, defect)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
101 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox99 --- wontfix
firefox100 --- wontfix
firefox101 --- verified

People

(Reporter: jkratzer, Assigned: jimb)

References

(Blocks 2 open bugs, Regression)

Details

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

Crash Data

Attachments

(3 files)

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

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build ae6487188557 --asan --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.zip
[@ mozilla::dom::HTMLCanvasElement::ToDataURLImpl]

    =================================================================
    ==4137939==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f207807d2fb bp 0x7fff0330c4f0 sp 0x7fff0330c100 T0)
    ==4137939==The signal is caused by a READ memory access.
    ==4137939==Hint: address points to the zero page.
        #0 0x7f207807d2fb in mozilla::dom::HTMLCanvasElement::ToDataURLImpl(JSContext*, nsIPrincipal&, nsTSubstring<char16_t> const&, JS::Value const&, nsTSubstring<char16_t>&) /dom/html/HTMLCanvasElement.cpp:916:16
        #1 0x7f207807c947 in mozilla::dom::HTMLCanvasElement::ToDataURL(JSContext*, nsTSubstring<char16_t> const&, JS::Handle<JS::Value>, nsTSubstring<char16_t>&, nsIPrincipal&, mozilla::ErrorResult&) /dom/html/HTMLCanvasElement.cpp:748:17
        #2 0x7f207739830c in mozilla::dom::HTMLCanvasElement_Binding::toDataURL(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/HTMLCanvasElementBinding.cpp:619:24
        #3 0x7f2077581ccd 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
        #4 0x7f207f2ab094 in CallJSNative /js/src/vm/Interpreter.cpp:425:13
        #5 0x7f207f2ab094 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:512:12
        #6 0x7f207f2975ae in CallFromStack /js/src/vm/Interpreter.cpp:576:10
        #7 0x7f207f2975ae in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3309:16
        #8 0x7f207f27c3b1 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:394:13
        #9 0x7f207f2ab1cf in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:544:13
        #10 0x7f207f2ad31b 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:589:8
        #11 0x7f207f46340d 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 0x7f20771ad6a9 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 0x7f2077e77954 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 0x7f2077e77410 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /dom/events/EventListenerManager.cpp:1308:43
        #15 0x7f2077e78abc in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1505:17
        #16 0x7f2077e66bde in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:348:17
        #17 0x7f2077e653ed in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:550:16
        #18 0x7f2077e69665 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1085:11
        #19 0x7f207a8d60f7 in nsDocumentViewer::LoadComplete(nsresult) /layout/base/nsDocumentViewer.cpp:1084:7
        #20 0x7f207e339ad3 in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) /docshell/base/nsDocShell.cpp:6403:20
        #21 0x7f207e338dcb in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /docshell/base/nsDocShell.cpp:5792:7
        #22 0x7f207e33ad9f in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /docshell/base/nsDocShell.cpp
        #23 0x7f2074435830 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /uriloader/base/nsDocLoader.cpp:1377:3
        #24 0x7f2074434444 in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /uriloader/base/nsDocLoader.cpp:975:14
        #25 0x7f2074430c72 in nsDocLoader::DocLoaderIsEmpty(bool, mozilla::Maybe<nsresult> const&) /uriloader/base/nsDocLoader.cpp:794:9
        #26 0x7f2074432e35 in nsDocLoader::OnStopRequest(nsIRequest*, nsresult) /uriloader/base/nsDocLoader.cpp:677:5
        #27 0x7f207e3739bb in nsDocShell::OnStopRequest(nsIRequest*, nsresult) /docshell/base/nsDocShell.cpp:13715:23
        #28 0x7f207212722e in mozilla::net::nsLoadGroup::NotifyRemovalObservers(nsIRequest*, nsresult) /netwerk/base/nsLoadGroup.cpp:614:22
        #29 0x7f2072129c73 in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /netwerk/base/nsLoadGroup.cpp:518:10
        #30 0x7f207569ab62 in mozilla::dom::Document::DoUnblockOnload() /dom/base/Document.cpp:11549:18
        #31 0x7f2075647f67 in mozilla::dom::Document::UnblockOnload(bool) /dom/base/Document.cpp:11479:9
        #32 0x7f207567291c in mozilla::dom::Document::DispatchContentLoadedEvents() /dom/base/Document.cpp:7994:3
        #33 0x7f207576259d in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1147:12
        #34 0x7f207576259d in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1153:12
        #35 0x7f207576259d 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
        #36 0x7f2071d8979f in mozilla::SchedulerGroup::Runnable::Run() /xpcom/threads/SchedulerGroup.cpp:140:20
        #37 0x7f2071dd85d2 in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:467:16
        #38 0x7f2071d9cc5d in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:770:26
        #39 0x7f2071d9a1b8 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:606:15
        #40 0x7f2071d9a8c9 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:390:36
        #41 0x7f2071de0cd1 in operator() /xpcom/threads/TaskController.cpp:124:37
        #42 0x7f2071de0cd1 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() /xpcom/threads/nsThreadUtils.h:531:5
        #43 0x7f2071dbd9c7 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1171:16
        #44 0x7f2071dc8f3c in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:467:10
        #45 0x7f20732efccf in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:85:21
        #46 0x7f2073168341 in RunInternal /ipc/chromium/src/base/message_loop.cc:331:10
        #47 0x7f2073168341 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #48 0x7f2073168341 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #49 0x7f207a2716f7 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:137:27
        #50 0x7f207efc788f in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:878:20
        #51 0x7f2073168341 in RunInternal /ipc/chromium/src/base/message_loop.cc:331:10
        #52 0x7f2073168341 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #53 0x7f2073168341 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #54 0x7f207efc6ac3 in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:715:34
        #55 0x5615d461480d in content_process_main(mozilla::Bootstrap*, int, char**) /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
        #56 0x5615d4614c40 in main /browser/app/nsBrowserApp.cpp:327:18
        #57 0x7f20968140b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
        #58 0x5615d45638d9 in _start (/home/jkratzer/builds/mc-asan/firefox+0x5d8d9)
    
    AddressSanitizer can not provide additional info.
    SUMMARY: AddressSanitizer: SEGV /dom/html/HTMLCanvasElement.cpp:916:16 in mozilla::dom::HTMLCanvasElement::ToDataURLImpl(JSContext*, nsIPrincipal&, nsTSubstring<char16_t> const&, JS::Value const&, nsTSubstring<char16_t>&)
    ==4137939==ABORTING
Attached file Testcase

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

Start: 60c6b98b954e8d31353f9934e4b7c1581fd07d37 (20210903164901)
End: ef5dc3e04e5f271eea0636ab3a495e95cc912f1d (20210903165630)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=60c6b98b954e8d31353f9934e4b7c1581fd07d37&tochange=ef5dc3e04e5f271eea0636ab3a495e95cc912f1d

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

The severity field is not set for this bug.
:jimb, could you have a look please?

For more information, please visit auto_nag documentation.

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

I can reproduce this on Mozilla Central 8dff65812a56 (2022-4-20).

Continue to set the returned stream to nullptr (which callers do not
check for, but is safe), but return NS_ERROR_NOT_IMPLEMENTED instead
of NS_OK --- callers do check the nsresult.

Returning an NS_FAILED result from our GetInputStream
implementation causes HTMLCanvasElement.prototype.toDataURL to
return the fallback value "data:,".

Assignee: nobody → jimb
Status: NEW → ASSIGNED

:jimb, since this bug contains a bisection range, could you fill (if possible) the regressed_by field?
For more information, please visit auto_nag documentation.

Flags: needinfo?(jimb)
Flags: needinfo?(jimb)
Regressed by: 1726626

Set release status flags based on info from the regressing bug 1726626

Pushed by jblandy@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/25a864f2627d
Return NOT_IMPLEMENTED from mozilla::webgpu::CanvasContext::GetInputStream. r=jgilbert
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 101 Branch

Bugmon Analysis
Verified bug as fixed on rev mozilla-central 20220422033915-e54b77f74624.
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
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: