OfflineAudioContext does not validate allocation of destination buffer
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Oct 2019 14:18:01 +0000 (14:18 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Oct 2019 14:18:01 +0000 (14:18 +0000)
commit818ad9102a49c08998cd450c648918caaad0e33e
tree99fe4109e0d8e2e20832a4e761f6c9785498b003
parenta5ff6a35a29715e59dc01ce4dca77bac0350c433
OfflineAudioContext does not validate allocation of destination buffer
https://bugs.webkit.org/show_bug.cgi?id=177259

Patch by Bjorn Melinder <bjornm@spotify.com> on 2019-10-11
Reviewed by Eric Carlson.

Moved the allocation of the destination buffer to the static
OfflineAudioContext::create method where we are able to handle a failed
allocation properly and return an Exception. This change handles both
negative lengths as well as too large lengths where the memory cannot
be allocated.

Source/WebCore:

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext):
* Modules/webaudio/AudioContext.h:
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::OfflineAudioContext):
(WebCore::OfflineAudioContext::create):
* Modules/webaudio/OfflineAudioContext.h:

LayoutTests:

* webaudio/offlineaudiocontext-constructor-expected.txt:
* webaudio/offlineaudiocontext-constructor.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251007 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/webaudio/offlineaudiocontext-constructor-expected.txt
LayoutTests/webaudio/offlineaudiocontext-constructor.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/webaudio/AudioContext.cpp
Source/WebCore/Modules/webaudio/AudioContext.h
Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp
Source/WebCore/Modules/webaudio/OfflineAudioContext.h