Closed Bug 1759527 Opened 2 years ago Closed 2 years ago

Crash [@ mozilla::dom::ImageBitmapRenderingContext::GetSurfaceSnapshot]

Categories

(Core :: Graphics: Canvas2D, defect, P3)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
100 Branch
Tracking Status
firefox98 --- wontfix
firefox99 --- fixed
firefox100 --- fixed

People

(Reporter: jkratzer, Assigned: aosmond)

References

(Blocks 1 open bug)

Details

(Keywords: testcase)

Crash Data

Attachments

(2 files)

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

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build 7e01ab125e4c --asan --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.zip
[@ mozilla::dom::ImageBitmapRenderingContext::GetSurfaceSnapshot]

    =================================================================
    ==2581853==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f81e922ecdc bp 0x7ffeec870fb0 sp 0x7ffeec870f80 T0)
    ==2581853==The signal is caused by a READ memory access.
    ==2581853==Hint: address points to the zero page.
        #0 0x7f81e922ecdc in mozilla::dom::ImageBitmapRenderingContext::GetSurfaceSnapshot(gfxAlphaType*) /dom/canvas/ImageBitmapRenderingContext.cpp:198:16
        #1 0x7f81e9be6e1d in mozilla::dom::RequestedFrameRefreshObserver::CaptureFrame(mozilla::TimeStamp) /dom/html/HTMLCanvasElement.cpp:242:34
        #2 0x7f81e9be60c0 in mozilla::dom::RequestedFrameRefreshObserver::WillRefresh(mozilla::TimeStamp) /dom/html/HTMLCanvasElement.cpp:198:5
        #3 0x7f81ec91bdbc in nsRefreshDriver::Tick(mozilla::layers::BaseTransactionId<mozilla::VsyncIdType>, mozilla::TimeStamp, nsRefreshDriver::IsExtraTick) /layout/base/nsRefreshDriver.cpp:2443:12
        #4 0x7f81ec92a0a7 in TickDriver /layout/base/nsRefreshDriver.cpp:367:13
        #5 0x7f81ec92a0a7 in mozilla::RefreshDriverTimer::TickRefreshDrivers(mozilla::layers::BaseTransactionId<mozilla::VsyncIdType>, mozilla::TimeStamp, nsTArray<RefPtr<nsRefreshDriver> >&) /layout/base/nsRefreshDriver.cpp:345:7
        #6 0x7f81ec929e0d in mozilla::RefreshDriverTimer::Tick(mozilla::layers::BaseTransactionId<mozilla::VsyncIdType>, mozilla::TimeStamp) /layout/base/nsRefreshDriver.cpp:361:5
        #7 0x7f81ec929ac5 in mozilla::VsyncRefreshDriverTimer::RunRefreshDrivers(mozilla::layers::BaseTransactionId<mozilla::VsyncIdType>, mozilla::TimeStamp) /layout/base/nsRefreshDriver.cpp:881:5
        #8 0x7f81ec928bf9 in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::TickRefreshDriver(mozilla::layers::BaseTransactionId<mozilla::VsyncIdType>, mozilla::TimeStamp) /layout/base/nsRefreshDriver.cpp:761:16
        #9 0x7f81ec927de9 in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::NotifyVsyncOnMainThread() /layout/base/nsRefreshDriver.cpp:642:7
        #10 0x7f81ec927818 in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::NotifyVsync(mozilla::VsyncEvent const&) /layout/base/nsRefreshDriver.cpp:534:9
        #11 0x7f81eb67149e in mozilla::dom::VsyncMainChild::RecvNotify(mozilla::VsyncEvent const&, float const&) /dom/ipc/VsyncMainChild.cpp:68:15
        #12 0x7f81eba64482 in mozilla::dom::PVsyncChild::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PVsyncChild.cpp:220:54
        #13 0x7f81e57edab1 in mozilla::ipc::PBackgroundChild::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PBackgroundChild.cpp:6370:32
        #14 0x7f81e57526c9 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(mozilla::ipc::ActorLifecycleProxy*, IPC::Message const&) /ipc/glue/MessageChannel.cpp:1674:25
        #15 0x7f81e57501e2 in mozilla::ipc::MessageChannel::DispatchMessage(mozilla::ipc::ActorLifecycleProxy*, IPC::Message&&) /ipc/glue/MessageChannel.cpp:1599:9
        #16 0x7f81e5751799 in mozilla::ipc::MessageChannel::MessageTask::Run() /ipc/glue/MessageChannel.cpp:1496:14
        #17 0x7f81e406aab2 in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:467:16
        #18 0x7f81e402efad in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:775:26
        #19 0x7f81e402c4b8 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:611:15
        #20 0x7f81e402cbc9 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:390:36
        #21 0x7f81e4073484 in operator() /xpcom/threads/TaskController.cpp:127:37
        #22 0x7f81e4073484 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_1>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:531:5
        #23 0x7f81e404fd47 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1173:16
        #24 0x7f81e405b2ec in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:467:10
        #25 0x7f81e5759924 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:107:5
        #26 0x7f81e55d6cd1 in RunInternal /ipc/chromium/src/base/message_loop.cc:331:10
        #27 0x7f81e55d6cd1 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #28 0x7f81e55d6cd1 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #29 0x7f81ec3d9257 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:137:27
        #30 0x7f81f1266b2f in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:870:20
        #31 0x7f81e55d6cd1 in RunInternal /ipc/chromium/src/base/message_loop.cc:331:10
        #32 0x7f81e55d6cd1 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #33 0x7f81e55d6cd1 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #34 0x7f81f1265d53 in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:729:34
        #35 0x55a2589c347d in content_process_main(mozilla::Bootstrap*, int, char**) /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
        #36 0x55a2589c38b0 in main /browser/app/nsBrowserApp.cpp:327:18
        #37 0x7f8208b8e0b2 in __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:308:16
        #38 0x55a258912569 in _start (/home/jkratzer/builds/mc-asan/firefox+0x5e569)
    
    AddressSanitizer can not provide additional info.
    SUMMARY: AddressSanitizer: SEGV /dom/canvas/ImageBitmapRenderingContext.cpp:198:16 in mozilla::dom::ImageBitmapRenderingContext::GetSurfaceSnapshot(gfxAlphaType*)
    ==2581853==ABORTING
Attached file Testcase
Keywords: bugmon
Whiteboard: [bugmon:confirm]
Assignee: nobody → aosmond
Severity: -- → S3
Priority: -- → P3

This could happen when the content process cannot access the underlying
surface directly for example.

Pushed by aosmond@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/77f52e801e50
Ensure ImageBitmapRenderingContext checks for null surfaces. r=gfx-reviewers,jnicol
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch

Comment on attachment 9267842 [details]
Bug 1759527 - Ensure ImageBitmapRenderingContext checks for null surfaces.

Beta/Release Uplift Approval Request

  • User impact if declined: User may experience crash in content process if we cannot get a surface from an ImageBitmapRenderingContext canvas
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Just adds some null pointer checks, uses existing error path to handle that
  • String changes made/needed:
Attachment #9267842 - Flags: approval-mozilla-beta?

Comment on attachment 9267842 [details]
Bug 1759527 - Ensure ImageBitmapRenderingContext checks for null surfaces.

Approved for 99.0b5. Thanks.

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

Attachment

General

Created:
Updated:
Size: