Closed Bug 1805327 Opened 2 years ago Closed 2 years ago

gecko/dom/media/webaudio/AudioBuffer.cpp:345:45: runtime error: pointer index expression with base 0xcb23b800 overflowed to 0x18baefec

Categories

(Core :: Web Audio, defect, P1)

x86
Unspecified
defect

Tracking

()

RESOLVED FIXED
110 Branch
Tracking Status
firefox-esr102 --- wontfix
firefox108 --- wontfix
firefox109 --- wontfix
firefox110 --- fixed

People

(Reporter: tsmith, Assigned: karlt)

References

(Blocks 2 open bugs)

Details

(Keywords: csectype-undefined, testcase)

Attachments

(2 files)

Attached file testcase.html

Found while fuzzing 20221209-4af9c56eb6d8 (--enable-undefined-sanitizer --enable-fuzzing)

To reproduce via Grizzly Replay:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch -a --fuzzing --cpu x86 -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.html
gecko/dom/media/webaudio/AudioBuffer.cpp:345:45: runtime error: pointer index expression with base 0xcb23b800 overflowed to 0x18baefec
    #0 0xe1038b18 in mozilla::dom::AudioBuffer::CopyFromChannel(mozilla::dom::TypedArray<JS::TypedArray<(JS::Scalar::Type)6>> const&, unsigned int, unsigned int, mozilla::ErrorResult&) gecko/dom/media/webaudio/AudioBuffer.cpp
    #1 0xdc44c754 in mozilla::dom::AudioBuffer_Binding::copyFromChannel(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/AudioBufferBinding.cpp:417:24
    #2 0xdebeae4e in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) gecko/dom/bindings/BindingUtils.cpp:3287:13
    #3 0xe99a2be0 in CallJSNative gecko/js/src/vm/Interpreter.cpp:459:13
    #4 0xe99a2be0 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) gecko/js/src/vm/Interpreter.cpp:547:12
    #5 0xe997a765 in InternalCall gecko/js/src/vm/Interpreter.cpp:614:10
    #6 0xe997a765 in CallFromStack gecko/js/src/vm/Interpreter.cpp:619:10
    #7 0xe997a765 in Interpret(JSContext*, js::RunState&) gecko/js/src/vm/Interpreter.cpp:3379:16
    #8 0xe995ca3a in js::RunScript(JSContext*, js::RunState&) gecko/js/src/vm/Interpreter.cpp:431:13
    #9 0xe99a2d32 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) gecko/js/src/vm/Interpreter.cpp:579:13
    #10 0xe99a5897 in InternalCall gecko/js/src/vm/Interpreter.cpp:614:10
    #11 0xe99a5897 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) gecko/js/src/vm/Interpreter.cpp:646:8
    #12 0xe9b28997 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) gecko/js/src/vm/CallAndConstruct.cpp:117:10
    #13 0xde63ca4f 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
    #14 0xdf9b0c19 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
    #15 0xdf9b0571 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) gecko/dom/events/EventListenerManager.cpp:1311:43
    #16 0xdf9b20f7 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) gecko/dom/events/EventListenerManager.cpp:1507:17
    #17 0xdf999368 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) gecko/dom/events/EventDispatcher.cpp:347:17
    #18 0xdf99765f in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) gecko/dom/events/EventDispatcher.cpp:549:16
    #19 0xdf99c534 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) gecko/dom/events/EventDispatcher.cpp:1118:11
    #20 0xdf9a4d73 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) gecko/dom/events/EventDispatcher.cpp
    #21 0xdc226d50 in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) gecko/dom/base/nsINode.cpp:1373:17
    #22 0xdb95078c in nsContentUtils::DispatchEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, mozilla::Trusted, bool*, mozilla::ChromeOnlyDispatch) gecko/dom/base/nsContentUtils.cpp:4536:28
    #23 0xdb950515 in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) gecko/dom/base/nsContentUtils.cpp:4506:10
    #24 0xdbd88ab7 in mozilla::dom::Document::DispatchContentLoadedEvents() gecko/dom/base/Document.cpp:7876:3
    #25 0xdbec1920 in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1162:12
    #26 0xdbec1920 in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1168:12
    #27 0xdbec1920 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:1215:13
    #28 0xd7d89d37 in mozilla::SchedulerGroup::Runnable::Run() gecko/xpcom/threads/SchedulerGroup.cpp:140:20
    #29 0xd7da4ca2 in mozilla::RunnableTask::Run() gecko/xpcom/threads/TaskController.cpp:538:16
    #30 0xd7d97c22 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) gecko/xpcom/threads/TaskController.cpp:851:26
    #31 0xd7d93bde in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) gecko/xpcom/threads/TaskController.cpp:683:15
    #32 0xd7d945c6 in mozilla::TaskController::ProcessPendingMTTask(bool) gecko/xpcom/threads/TaskController.cpp:461:36
    #33 0xd7dad830 in operator() gecko/xpcom/threads/TaskController.cpp:187:37
    #34 0xd7dad830 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_2>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:546:5
    #35 0xd7ddf134 in nsThread::ProcessNextEvent(bool, bool*) gecko/xpcom/threads/nsThread.cpp:1204:16
    #36 0xd7dee66a in NS_ProcessNextEvent(nsIThread*, bool) gecko/xpcom/threads/nsThreadUtils.cpp:474:10
    #37 0xd9b4c292 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) gecko/ipc/glue/MessagePump.cpp:85:21
    #38 0xd9b4e292 in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) gecko/ipc/glue/MessagePump.cpp:268:30
    #39 0xd9958f07 in RunInternal gecko/ipc/chromium/src/base/message_loop.cc:381:10
    #40 0xd9958f07 in RunHandler gecko/ipc/chromium/src/base/message_loop.cc:374:3
    #41 0xd9958f07 in MessageLoop::Run() gecko/ipc/chromium/src/base/message_loop.cc:356:3
    #42 0xe33f652f in nsBaseAppShell::Run() gecko/widget/nsBaseAppShell.cpp:150:27
    #43 0xe946de87 in XRE_RunAppShell() gecko/toolkit/xre/nsEmbedFunctions.cpp:884:20
    #44 0xd9958f07 in RunInternal gecko/ipc/chromium/src/base/message_loop.cc:381:10
    #45 0xd9958f07 in RunHandler gecko/ipc/chromium/src/base/message_loop.cc:374:3
    #46 0xd9958f07 in MessageLoop::Run() gecko/ipc/chromium/src/base/message_loop.cc:356:3
    #47 0xe946c87c in XRE_InitChildProcess(int, char**, XREChildData const*) gecko/toolkit/xre/nsEmbedFunctions.cpp:743:34
    #48 0xe9484b01 in mozilla::BootstrapImpl::XRE_InitChildProcess(int, char**, XREChildData const*) gecko/toolkit/xre/Bootstrap.cpp:67:12
    #49 0x567ca83b in content_process_main(mozilla::Bootstrap*, int, char**) gecko/browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
    #50 0x567cadad in main gecko/browser/app/nsBrowserApp.cpp:359:18
    #51 0xf79f3518  (/lib/i386-linux-gnu/libc.so.6+0x21518) (BuildId: 0494f075afbcfa9004eaaedccbea53807b7bf669)
    #52 0xf79f35f2 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x215f2) (BuildId: 0494f075afbcfa9004eaaedccbea53807b7bf669)
    #53 0x567085c0 in _start (/home/user/workspace/browsers/linux32-m-c-20221209160025-fuzzing-asan-opt/firefox-bin+0xf45c0) (BuildId: da89e6d39f5fe8bb0e8098e54b29ac711459ff26)
Flags: in-testsuite?

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(karlt)
Assignee: nobody → karlt
Severity: -- → S4
Status: NEW → ASSIGNED
Flags: needinfo?(karlt)
Priority: -- → P1

to avoid undefined behavior when there is nothing to copy.

Tests are based on testcase by Tyson Smith <twsmith@mozilla.com>.

Pushed by ktomlinson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/27d141453dbf return early if aBufferOffset might overflow as pointer index r=padenot
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/37777 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: