Assertion failure: aDst + aNElem <= aSrc || aSrc + aNElem <= aDst (destination and source must not overlap), at /builds/worker/workspace/obj-build/dist/include/mozilla/PodOperations.h:99
Categories
(Core :: Audio/Video: Web Codecs, defect, P2)
Tracking
()
People
(Reporter: jkratzer, Assigned: chunmin)
References
(Blocks 2 open bugs, Regression)
Details
(Keywords: regression, testcase, Whiteboard: [bugmon:bisected,confirmed])
Attachments
(5 files)
Testcase found while fuzzing mozilla-central rev 211dc86c8f53 (built with: --enable-debug --enable-fuzzing).
Testcase can be reproduced using the following commands:
$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build 211dc86c8f53 --debug --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.html
Assertion failure: aDst + aNElem <= aSrc || aSrc + aNElem <= aDst (destination and source must not overlap), at /builds/worker/workspace/obj-build/dist/include/mozilla/PodOperations.h:99
==1169932==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fc614b0dd43 bp 0x7ffed0aea2e0 sp 0x7ffed0aea2b0 T1169932)
==1169932==The signal is caused by a WRITE memory access.
==1169932==Hint: address points to the zero page.
#0 0x7fc614b0dd43 in PodCopy<unsigned char> /builds/worker/workspace/obj-build/dist/include/mozilla/PodOperations.h:98:3
#1 0x7fc614b0dd43 in mozilla::dom::VideoFrame::Resource::CopyTo(mozilla::dom::VideoFrame::Format::Plane const&, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&, mozilla::Span<unsigned char, 18446744073709551615ul>&&, unsigned long) const::$_0::operator()(unsigned char const*) const /dom/media/webcodecs/VideoFrame.cpp:2192:7
#2 0x7fc614b0d71b in mozilla::dom::VideoFrame::Resource::CopyTo(mozilla::dom::VideoFrame::Format::Plane const&, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&, mozilla::Span<unsigned char, 18446744073709551615ul>&&, unsigned long) const /dom/media/webcodecs/VideoFrame.cpp
#3 0x7fc614b143d8 in mozilla::dom::VideoFrame::CopyTo(mozilla::dom::MaybeSharedArrayBufferViewOrMaybeSharedArrayBuffer const&, mozilla::dom::VideoFrameCopyToOptions const&, mozilla::ErrorResult&)::$_0::operator()(mozilla::Span<unsigned char, 18446744073709551615ul> const&) const /dom/media/webcodecs/VideoFrame.cpp:1697:23
#4 0x7fc614b0b463 in CallProcessor<(lambda at /dom/media/webcodecs/VideoFrame.cpp:1664:48)> /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:576:12
#5 0x7fc614b0b463 in ProcessFixedData<(lambda at /dom/media/webcodecs/VideoFrame.cpp:1664:48)> /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:646:12
#6 0x7fc614b0b463 in operator()<mozilla::dom::TypedArray<JS::ArrayBuffer> > /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:978:28
#7 0x7fc614b0b463 in Apply<(lambda at /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:977:15)> /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:894:1
#8 0x7fc614b0b463 in Apply<(lambda at /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:977:15)> /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:907:19
#9 0x7fc614b0b463 in Apply<(lambda at /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:977:15)> /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:915:16
#10 0x7fc614b0b463 in ApplyToTypedArrays<mozilla::dom::MaybeSharedArrayBufferViewOrMaybeSharedArrayBuffer, (lambda at /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:977:15)> /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:927:7
#11 0x7fc614b0b463 in ProcessTypedArraysFixed<mozilla::dom::MaybeSharedArrayBufferViewOrMaybeSharedArrayBuffer, (lambda at /dom/media/webcodecs/VideoFrame.cpp:1664:48), 0> /builds/worker/workspace/obj-build/dist/include/mozilla/dom/TypedArray.h:976:10
#12 0x7fc614b0b463 in mozilla::dom::VideoFrame::CopyTo(mozilla::dom::MaybeSharedArrayBufferViewOrMaybeSharedArrayBuffer const&, mozilla::dom::VideoFrameCopyToOptions const&, mozilla::ErrorResult&) /dom/media/webcodecs/VideoFrame.cpp:1664:10
#13 0x7fc61318bc20 in copyTo /builds/worker/workspace/obj-build/dom/bindings/./VideoFrameBinding.cpp:1298:60
#14 0x7fc61318bc20 in mozilla::dom::VideoFrame_Binding::copyTo_promiseWrapper(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/./VideoFrameBinding.cpp:1312:13
#15 0x7fc6138a5ec9 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ConvertExceptionsToPromises>(JSContext*, unsigned int, JS::Value*) /dom/bindings/BindingUtils.cpp:3330:13
#16 0x7fc618073c34 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:472:13
#17 0x7fc61807354d in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:566:12
#18 0x7fc618083b18 in CallFromStack /js/src/vm/Interpreter.cpp:638:10
#19 0x7fc618083b18 in js::Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3053:16
#20 0x7fc618072aa2 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:444:13
#21 0x7fc618073569 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:598:13
#22 0x7fc618074a0d 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:665:8
#23 0x7fc61815ba64 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
#24 0x7fc6135b82fc 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
#25 0x7fc613f17ee6 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
#26 0x7fc613f17aa2 in mozilla::EventListenerManager::HandleEventSingleListener(mozilla::EventListenerManager::Listener*, nsAtom*, mozilla::WidgetEvent*, mozilla::dom::Event*, mozilla::dom::EventTarget*, bool) /dom/events/EventListenerManager.cpp:1342:43
#27 0x7fc613f18be4 in mozilla::EventListenerManager::HandleEventWithListenerArray(mozilla::EventListenerManager::ListenerArray*, nsAtom*, mozilla::EventMessage, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, bool) /dom/events/EventListenerManager.cpp:1663:12
#28 0x7fc613f18459 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1560:35
#29 0x7fc613f0ba4f in HandleEvent /builds/worker/workspace/obj-build/dist/include/mozilla/EventListenerManager.h:465:5
#30 0x7fc613f0ba4f in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:364:17
#31 0x7fc613f0afcb in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:611:18
#32 0x7fc613f0da06 in mozilla::EventDispatcher::Dispatch(mozilla::dom::EventTarget*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1232:11
#33 0x7fc613f10d96 in mozilla::EventDispatcher::DispatchDOMEvent(mozilla::dom::EventTarget*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /dom/events/EventDispatcher.cpp
#34 0x7fc61254d1e9 in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /dom/base/nsINode.cpp:1401:17
#35 0x7fc612062c5c in nsContentUtils::DispatchEvent(mozilla::dom::Document*, mozilla::dom::EventTarget*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, mozilla::Trusted, bool*, mozilla::ChromeOnlyDispatch) /dom/base/nsContentUtils.cpp:4635:29
#36 0x7fc612062ac2 in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, mozilla::dom::EventTarget*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) /dom/base/nsContentUtils.cpp:4601:10
#37 0x7fc6122ac335 in mozilla::dom::Document::DispatchContentLoadedEvents() /dom/base/Document.cpp:8044:3
#38 0x7fc61235f499 in operator()<> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1164:18
#39 0x7fc61235f499 in __invoke_impl<void, (lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1163:9)> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/invoke.h:60:14
#40 0x7fc61235f499 in __invoke<(lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1163:9)> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/invoke.h:95:14
#41 0x7fc61235f499 in __apply_impl<(lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1163:9), std::tuple<> &> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/tuple:1678:14
#42 0x7fc61235f499 in apply<(lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1163:9), std::tuple<> &> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/tuple:1687:14
#43 0x7fc61235f499 in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1162:12
#44 0x7fc61235f499 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:1213:13
#45 0x7fc6106a2f27 in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:549:16
#46 0x7fc61069aaf3 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:876:26
#47 0x7fc610699337 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:699:15
#48 0x7fc610699795 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:485:36
#49 0x7fc6106a6c36 in operator() /xpcom/threads/TaskController.cpp:211:37
#50 0x7fc6106a6c36 in mozilla::detail::RunnableFunction<mozilla::TaskController::TaskController()::$_0>::Run() /xpcom/threads/nsThreadUtils.h:548:5
#51 0x7fc6106bd792 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1198:16
#52 0x7fc6106c487d in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:480:10
#53 0x7fc611381d05 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:85:21
#54 0x7fc61129bc31 in RunHandler /ipc/chromium/src/base/message_loop.cc:363:3
#55 0x7fc61129bc31 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:345:3
#56 0x7fc615be78f8 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:148:27
#57 0x7fc617e34c6b in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:721:20
#58 0x7fc611382be6 in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:235:9
#59 0x7fc61129bc31 in RunHandler /ipc/chromium/src/base/message_loop.cc:363:3
#60 0x7fc61129bc31 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:345:3
#61 0x7fc617e344d2 in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:656:34
#62 0x5583f8b9c276 in content_process_main /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
#63 0x5583f8b9c276 in main /browser/app/nsBrowserApp.cpp:375:18
#64 0x7fc624a78d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#65 0x7fc624a78e3f in __libc_start_main csu/../csu/libc-start.c:392:3
#66 0x5583f8b71fa8 in _start (/home/jkratzer/builds/m-c-20231113091505-fuzzing-debug/firefox-bin+0x58fa8) (BuildId: c8a40462047621d4157d002b8b9277484ae9dbc8)
UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV /builds/worker/workspace/obj-build/dist/include/mozilla/PodOperations.h:98:3 in PodCopy<unsigned char>
==1169932==ABORTING
| Reporter | ||
Comment 1•2 years ago
|
||
Comment 2•2 years ago
|
||
Verified bug as reproducible on mozilla-central 20231113215623-a517db1d17ab.
The bug appears to have been introduced in the following build range:
Start: 7183c524620f567af6e8518132738a0ce1a605b8 (20230615195928)
End: ba00fe639072b671be556332e4628092d64d31df (20230615205119)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=7183c524620f567af6e8518132738a0ce1a605b8&tochange=ba00fe639072b671be556332e4628092d64d31df
Comment 3•2 years ago
|
||
This bug has been marked as a regression. Setting status flag for Nightly to affected.
Updated•2 years ago
|
Comment 4•2 years ago
|
||
:chunmin, since you are the author of the regressor, bug 1838487, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Updated•2 years ago
|
Comment 5•2 years ago
|
||
Set release status flags based on info from the regressing bug 1838487
| Assignee | ||
Comment 6•2 years ago
|
||
There is no impact on users since WebCodecs APIs are under a pref. I am doing other higher priority work, and will get back to this ASAP.
| Assignee | ||
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
| Assignee | ||
Comment 8•2 years ago
•
|
||
The assertion in PodCopy fails when copying the alpha channel data since aPlaneDest.data() (aka aDst) and aPlaneData (aka aSrc) are unexpectedly equal. The reason they are unexpectedly equal is because mData.mAlpha->mChannel isn't assigned to a right place in RecyclingPlanarYCbCrImage::CopyData when it's called in CreateYUVImageFromBuffer.
Adding mData.mAlpha->mChannel = mData.mCrChannel + mData.mCbCrStride * cbcrSize.height; in the if (aData.mAlpha) block in RecyclingPlanarYCbCrImage::CopyData should solve the problem.
| Assignee | ||
Updated•2 years ago
|
| Assignee | ||
Comment 9•2 years ago
|
||
| Assignee | ||
Comment 10•2 years ago
|
||
This patch fixes an assertion failure when copying I420A VideoFrame.
The assertion [1] in PodCopy [2] fails when copying the alpha channel
data since aPlaneDest.data() (aka aDst) and aPlaneData (aka
aSrc) are always the same. The reason they are unexpectedly equal is
becuase mData.mAlpha->mChannel [3] is NOT assigned to the right place
in RecyclingPlanarYCbCrImage::CopyData (via CreateYUVImageFromBuffer
[4]) when copying the given data to the allocated buffer.
To solve the problem, mData.mAlpha->mChannel must be set to the right
place.
[1] https://searchfox.org/mozilla-central/rev/b9d9a1a873302452fc918505d62cd226d81b67d0/mfbt/PodOperations.h#98
[2] https://searchfox.org/mozilla-central/rev/c130c69b7b863d5e28ab9524b65c27c7a9507c48/dom/media/webcodecs/VideoFrame.cpp#2227
[3] https://searchfox.org/mozilla-central/rev/b9d9a1a873302452fc918505d62cd226d81b67d0/gfx/layers/ImageContainer.cpp#818-821
[4] https://searchfox.org/mozilla-central/rev/c130c69b7b863d5e28ab9524b65c27c7a9507c48/dom/media/webcodecs/VideoFrame.cpp#798
Depends on D199372
Updated•2 years ago
|
| Assignee | ||
Comment 11•2 years ago
|
||
There is no need to create a Span<...> from a Span<...>.
Depends on D199373
| Assignee | ||
Comment 12•2 years ago
|
||
Run ./mach clang-format --path dom/media/webcodecs/VideoFramr.*
Depends on D199291
Comment 13•2 years ago
|
||
Comment 14•2 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/b09af391be9b
https://hg.mozilla.org/mozilla-central/rev/ac20f567105a
https://hg.mozilla.org/mozilla-central/rev/dd04aaba3d20
https://hg.mozilla.org/mozilla-central/rev/3f0e15507132
Comment 15•2 years ago
|
||
Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.
Comment 16•2 years ago
|
||
The patch landed in nightly and beta is affected.
:chunmin, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox123towontfix.
For more information, please visit BugBot documentation.
Comment 17•2 years ago
|
||
dom.media.webcodecs.enabled is enabled for Nightly only, marking 123 as disabled.
Comment 18•2 years ago
|
||
Verified bug as fixed on rev mozilla-central 20240126095257-a412d893c38f.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.
Description
•