Open Bug 1715363 Opened 3 years ago Updated 3 years ago

Large allocation after calling [@ mozilla::gfx::PathSkia::GetStrokedBounds]

Categories

(Core :: Graphics: Canvas2D, defect)

defect

Tracking

()

Tracking Status
firefox91 --- affected

People

(Reporter: tsmith, Unassigned)

References

(Blocks 2 open bugs)

Details

(Keywords: csectype-oom, testcase)

Attachments

(1 file)

Attached file testcase.html

Found while fuzzing m-c 20210604-963df76dc655 (--enable-address-sanitizer --enable-fuzzing)

To help catch this issue ASAN_OPTIONS=max_allocation_size_mb=512 was used. See Bug 1715316 for details about fuzzing triggered OOMs.

==243355==WARNING: AddressSanitizer failed to allocate 0x2521bd10 bytes
=================================================================
==243355==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000001 (pc 0x556965b73b48 bp 0x7ffcb0fbcc30 sp 0x7ffcb0fbcc20 T0)
==243355==The signal is caused by a WRITE memory access.
==243355==Hint: address points to the zero page.
    #0 0x556965b73b48 in mozalloc_abort src/memory/mozalloc/mozalloc_abort.cpp:33:3
    #1 0x556965b73cdd in mozalloc_handle_oom(unsigned long) src/memory/mozalloc/mozalloc_oom.cpp:51:3
    #2 0x556965b7420b in moz_xrealloc src/memory/mozalloc/mozalloc.cpp:74:5
    #3 0x7fde7295720c in SkTDArray<SkPoint>::resizeStorageToAtLeast(int) src/gfx/skia/skia/include/private/SkTDArray.h:364:22
    #4 0x7fde72957138 in setCount src/gfx/skia/skia/include/private/SkTDArray.h:145:19
    #5 0x7fde72957138 in SkTDArray<SkPoint>::adjustCount(int) src/gfx/skia/skia/include/private/SkTDArray.h:343:15
    #6 0x7fde72c02314 in append src/gfx/skia/skia/include/private/SkTDArray.h:176:19
    #7 0x7fde72c02314 in SkPathRef::growForVerb(int, float) src/gfx/skia/skia/src/core/SkPathRef.cpp:442:28
    #8 0x7fde72bef30a in growForVerb src/gfx/skia/skia/include/private/SkPathRef.h:70:30
    #9 0x7fde72bef30a in SkPath::lineTo(float, float) src/gfx/skia/skia/src/core/SkPath.cpp:634:8
    #10 0x7fde72bf53c4 in lineTo src/gfx/skia/skia/include/core/SkPath.h:601:22
    #11 0x7fde72bf53c4 in SkPath::reversePathTo(SkPath const&) src/gfx/skia/skia/src/core/SkPath.cpp:1444:23
    #12 0x7fde72c9cd44 in SkPathStroker::finishContour(bool, bool) src/gfx/skia/skia/src/core/SkStroke.cpp:324:20
    #13 0x7fde72ca78ae in done src/gfx/skia/skia/src/core/SkStroke.cpp:144:15
    #14 0x7fde72ca78ae in SkStroke::strokePath(SkPath const&, SkPath*) const src/gfx/skia/skia/src/core/SkStroke.cpp:1464:13
    #15 0x7fde72ca9583 in SkStrokeRec::applyToPath(SkPath*, SkPath const&) const src/gfx/skia/skia/src/core/SkStrokeRec.cpp:121:13
    #16 0x7fde72be9548 in SkPaint::getFillPath(SkPath const&, SkPath*, SkRect const*, float) const src/gfx/skia/skia/src/core/SkPaint.cpp:459:14
    #17 0x7fde6a66532a in getFillPath src/gfx/skia/skia/include/core/SkPaint.h:415:22
    #18 0x7fde6a66532a in mozilla::gfx::PathSkia::GetStrokedBounds(mozilla::gfx::StrokeOptions const&, mozilla::gfx::BaseMatrix<float> const&) const src/gfx/2d/PathSkia.cpp:172:9
    #19 0x7fde6d3cf613 in mozilla::dom::CanvasRenderingContext2D::Stroke(mozilla::dom::CanvasPath const&) src/dom/canvas/CanvasRenderingContext2D.cpp:2867:23
    #20 0x7fde6c55c34c in mozilla::dom::CanvasRenderingContext2D_Binding::stroke(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/CanvasRenderingContext2DBinding.cpp:3026:28
    #21 0x7fde6d29a979 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) src/dom/bindings/BindingUtils.cpp:3298:13
    #22 0x7fde740a6182 in CallJSNative src/js/src/vm/Interpreter.cpp:426:13
    #23 0x7fde740a6182 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) src/js/src/vm/Interpreter.cpp:511:12
    #24 0x7fde7408db5f in CallFromStack src/js/src/vm/Interpreter.cpp:575:10
    #25 0x7fde7408db5f in Interpret(JSContext*, js::RunState&) src/js/src/vm/Interpreter.cpp:3226:16
    #26 0x7fde740776b6 in js::RunScript(JSContext*, js::RunState&) src/js/src/vm/Interpreter.cpp:395:13
    #27 0x7fde740a62bb in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) src/js/src/vm/Interpreter.cpp:543:13
    #28 0x7fde740a7ebb in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) src/js/src/vm/Interpreter.cpp:588:8
    #29 0x7fde749152a2 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) src/js/src/jsapi.cpp:2777:10
    #30 0x7fde6cddaaf9 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:58:8
    #31 0x7fde6da51088 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
    #32 0x7fde6da50b80 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) src/dom/events/EventListenerManager.cpp:1108:43
    #33 0x7fde6da521a7 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) src/dom/events/EventListenerManager.cpp:1305:17
    #34 0x7fde6da3f52e in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) src/dom/events/EventDispatcher.cpp:355:17
    #35 0x7fde6da3dd51 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) src/dom/events/EventDispatcher.cpp:557:16
    #36 0x7fde6da42155 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) src/dom/events/EventDispatcher.cpp:1116:11
    #37 0x7fde6da47bd9 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) src/dom/events/EventDispatcher.cpp
    #38 0x7fde6b99139a in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) src/dom/base/nsINode.cpp:1331:17
    #39 0x7fde6b4639af in nsContentUtils::DispatchEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, mozilla::Trusted, bool*, mozilla::ChromeOnlyDispatch) src/dom/base/nsContentUtils.cpp:4316:28
    #40 0x7fde6b4636f3 in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) src/dom/base/nsContentUtils.cpp:4286:10
    #41 0x7fde6b6e4516 in mozilla::dom::Document::DispatchContentLoadedEvents() src/dom/base/Document.cpp:7687:3
    #42 0x7fde6b7a2a6f in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1150:12
    #43 0x7fde6b7a2a6f in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1156:12
    #44 0x7fde6b7a2a6f 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:1203:13
    #45 0x7fde682432bf in mozilla::SchedulerGroup::Runnable::Run() src/xpcom/threads/SchedulerGroup.cpp:143:20
    #46 0x7fde68287072 in mozilla::RunnableTask::Run() src/xpcom/threads/TaskController.cpp:483:16
    #47 0x7fde68253ce0 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) src/xpcom/threads/TaskController.cpp:786:26
    #48 0x7fde68251528 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) src/xpcom/threads/TaskController.cpp:622:15
    #49 0x7fde68251c3d in mozilla::TaskController::ProcessPendingMTTask(bool) src/xpcom/threads/TaskController.cpp:406:36
    #50 0x7fde682910b1 in operator() src/xpcom/threads/TaskController.cpp:139:37
    #51 0x7fde682910b1 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() src/xpcom/threads/nsThreadUtils.h:534:5
    #52 0x7fde6826e458 in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:1159:16
    #53 0x7fde6827919c in NS_ProcessNextEvent(nsIThread*, bool) src/xpcom/threads/nsThreadUtils.cpp:548:10
    #54 0x7fde694358bf in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:85:21
    #55 0x7fde6933d171 in RunInternal src/ipc/chromium/src/base/message_loop.cc:335:10
    #56 0x7fde6933d171 in RunHandler src/ipc/chromium/src/base/message_loop.cc:328:3
    #57 0x7fde6933d171 in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:310:3
    #58 0x7fde6fbdd4f7 in nsBaseAppShell::Run() src/widget/nsBaseAppShell.cpp:137:27
    #59 0x7fde73e51c8f in XRE_RunAppShell() src/toolkit/xre/nsEmbedFunctions.cpp:911:20
    #60 0x7fde6933d171 in RunInternal src/ipc/chromium/src/base/message_loop.cc:335:10
    #61 0x7fde6933d171 in RunHandler src/ipc/chromium/src/base/message_loop.cc:328:3
    #62 0x7fde6933d171 in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:310:3
    #63 0x7fde73e51668 in XRE_InitChildProcess(int, char**, XREChildData const*) src/toolkit/xre/nsEmbedFunctions.cpp:743:34
    #64 0x556965b6d74d in content_process_main(mozilla::Bootstrap*, int, char**) src/browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
    #65 0x556965b6db7d in main src/browser/app/nsBrowserApp.cpp:313:18
    #66 0x7fde89bc60b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
    #67 0x556965abea49 in _start (/home/user/workspace/browsers/m-c-20210604154219-fuzzing-asan-opt/firefox+0x5ba49)
Flags: in-testsuite?
Severity: -- → S3
See Also: → 1715357
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: