Changeset 251007 in webkit
- Timestamp:
- Oct 11, 2019, 7:18:01 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/webaudio/offlineaudiocontext-constructor-expected.txt (modified) (1 diff)
-
LayoutTests/webaudio/offlineaudiocontext-constructor.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioContext.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/webaudio/AudioContext.h (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/webaudio/OfflineAudioContext.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r251006 r251007 1 2019-10-11 Bjorn Melinder <bjornm@spotify.com> 2 3 OfflineAudioContext does not validate allocation of destination buffer 4 https://bugs.webkit.org/show_bug.cgi?id=177259 5 6 Reviewed by Eric Carlson. 7 8 Moved the allocation of the destination buffer to the static 9 OfflineAudioContext::create method where we are able to handle a failed 10 allocation properly and return an Exception. This change handles both 11 negative lengths as well as too large lengths where the memory cannot 12 be allocated. 13 14 * webaudio/offlineaudiocontext-constructor-expected.txt: 15 * webaudio/offlineaudiocontext-constructor.html: 16 1 17 2019-10-11 Chris Lord <clord@igalia.com> 2 18 -
trunk/LayoutTests/webaudio/offlineaudiocontext-constructor-expected.txt
r219663 r251007 5 5 6 6 PASS new webkitOfflineAudioContext(1, 0, 44100) threw exception SyntaxError: The string did not match the expected pattern.. 7 PASS new webkitOfflineAudioContext(1, -1, 44100) threw exception SyntaxError: The string did not match the expected pattern.. 8 PASS new webkitOfflineAudioContext(1, 99999999999, 44100) threw exception SyntaxError: The string did not match the expected pattern.. 7 9 PASS new webkitOfflineAudioContext(0, 1, 44100) threw exception SyntaxError: The string did not match the expected pattern.. 8 10 PASS new webkitOfflineAudioContext(1, 1, 0) threw exception SyntaxError: The string did not match the expected pattern.. -
trunk/LayoutTests/webaudio/offlineaudiocontext-constructor.html
r179565 r251007 7 7 description('This tests that passing zero to the "numberOfFrames" parameter of the OfflineAudioContext constructor does not cause a crash.'); 8 8 shouldThrow('new webkitOfflineAudioContext(1, 0, 44100)'); 9 shouldThrow('new webkitOfflineAudioContext(1, -1, 44100)'); 10 shouldThrow('new webkitOfflineAudioContext(1, 99999999999, 44100)'); 9 11 shouldThrow('new webkitOfflineAudioContext(0, 1, 44100)'); 10 12 shouldThrow('new webkitOfflineAudioContext(1, 1, 0)'); -
trunk/Source/WebCore/ChangeLog
r251000 r251007 1 2019-10-11 Bjorn Melinder <bjornm@spotify.com> 2 3 OfflineAudioContext does not validate allocation of destination buffer 4 https://bugs.webkit.org/show_bug.cgi?id=177259 5 6 Reviewed by Eric Carlson. 7 8 Moved the allocation of the destination buffer to the static 9 OfflineAudioContext::create method where we are able to handle a failed 10 allocation properly and return an Exception. This change handles both 11 negative lengths as well as too large lengths where the memory cannot 12 be allocated. 13 14 * Modules/webaudio/AudioContext.cpp: 15 (WebCore::AudioContext::AudioContext): 16 * Modules/webaudio/AudioContext.h: 17 * Modules/webaudio/OfflineAudioContext.cpp: 18 (WebCore::OfflineAudioContext::OfflineAudioContext): 19 (WebCore::OfflineAudioContext::create): 20 * Modules/webaudio/OfflineAudioContext.h: 21 1 22 2019-10-10 Konstantin Tokarev <annulen@yandex.ru> 2 23 -
trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp
r250542 r251007 159 159 160 160 // Constructor for offline (non-realtime) rendering. 161 AudioContext::AudioContext(Document& document, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)161 AudioContext::AudioContext(Document& document, AudioBuffer* renderTarget) 162 162 : ActiveDOMObject(document) 163 163 #if !RELEASE_LOG_DISABLED … … 168 168 , m_mediaSession(PlatformMediaSession::create(*this)) 169 169 , m_eventQueue(MainThreadGenericEventQueue::create(*this)) 170 , m_renderTarget(renderTarget) 170 171 { 171 172 constructCommon(); 172 173 173 174 // Create a new destination for offline rendering. 174 m_renderTarget = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate);175 175 m_destinationNode = OfflineAudioDestinationNode::create(*this, m_renderTarget.get()); 176 176 } -
trunk/Source/WebCore/Modules/webaudio/AudioContext.h
r250735 r251007 297 297 protected: 298 298 explicit AudioContext(Document&); 299 AudioContext(Document&, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);299 AudioContext(Document&, AudioBuffer* renderTarget); 300 300 301 301 static bool isSampleRateRangeGood(float sampleRate); -
trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp
r243887 r251007 36 36 WTF_MAKE_ISO_ALLOCATED_IMPL(OfflineAudioContext); 37 37 38 inline OfflineAudioContext::OfflineAudioContext(Document& document, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)39 : AudioContext(document, numberOfChannels, numberOfFrames, sampleRate)38 inline OfflineAudioContext::OfflineAudioContext(Document& document, AudioBuffer* renderTarget) 39 : AudioContext(document, renderTarget) 40 40 { 41 41 } … … 48 48 if (!numberOfChannels || numberOfChannels > 10 || !numberOfFrames || !isSampleRateRangeGood(sampleRate)) 49 49 return Exception { SyntaxError }; 50 auto audioContext = adoptRef(*new OfflineAudioContext(downcast<Document>(context), numberOfChannels, numberOfFrames, sampleRate)); 50 auto renderTarget = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate); 51 if (!renderTarget) 52 return Exception { SyntaxError }; 53 54 auto audioContext = adoptRef(*new OfflineAudioContext(downcast<Document>(context), renderTarget.get())); 51 55 audioContext->suspendIfNeeded(); 52 56 return audioContext; -
trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.h
r243887 r251007 35 35 36 36 private: 37 OfflineAudioContext(Document&, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);37 OfflineAudioContext(Document&, AudioBuffer* renderTarget); 38 38 }; 39 39
Note:
See TracChangeset
for help on using the changeset viewer.