Title: [277821] trunk/Source/WebCore
Revision
277821
Author
cdu...@apple.com
Date
2021-05-20 14:07:02 -0700 (Thu, 20 May 2021)

Log Message

WebAudioBufferList::setSampleCount() should early return if computeBufferSizes() fails
https://bugs.webkit.org/show_bug.cgi?id=226028
rdar://78222414

Reviewed by Eric Carlson.

If computeBufferSizes() fails (returns WTF::nullopt), we now early return on release
builds, without modifying the WebAudioBufferList's internal state in any way. In
Debug, we would still hit the assertion.

* platform/audio/cocoa/WebAudioBufferList.cpp:
(WebCore::WebAudioBufferList::setSampleCount):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (277820 => 277821)


--- trunk/Source/WebCore/ChangeLog	2021-05-20 19:59:33 UTC (rev 277820)
+++ trunk/Source/WebCore/ChangeLog	2021-05-20 21:07:02 UTC (rev 277821)
@@ -1,3 +1,18 @@
+2021-05-20  Chris Dumez  <cdu...@apple.com>
+
+        WebAudioBufferList::setSampleCount() should early return if computeBufferSizes() fails
+        https://bugs.webkit.org/show_bug.cgi?id=226028
+        rdar://78222414
+
+        Reviewed by Eric Carlson.
+
+        If computeBufferSizes() fails (returns WTF::nullopt), we now early return on release
+        builds, without modifying the WebAudioBufferList's internal state in any way. In
+        Debug, we would still hit the assertion.
+
+        * platform/audio/cocoa/WebAudioBufferList.cpp:
+        (WebCore::WebAudioBufferList::setSampleCount):
+
 2021-05-20  Antti Koivisto  <an...@apple.com>
 
         HTML parser should yield more aggressively

Modified: trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.cpp (277820 => 277821)


--- trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.cpp	2021-05-20 19:59:33 UTC (rev 277820)
+++ trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.cpp	2021-05-20 21:07:02 UTC (rev 277821)
@@ -90,11 +90,13 @@
     if (!sampleCount || m_sampleCount == sampleCount)
         return;
 
+    auto bufferSizes = computeBufferSizes(m_channelCount, m_bytesPerFrame, m_canonicalList->mNumberBuffers, sampleCount);
+    ASSERT(bufferSizes);
+    if (!bufferSizes)
+        return;
+
     m_sampleCount = sampleCount;
 
-    auto bufferSizes = computeBufferSizes(m_channelCount, m_bytesPerFrame, m_canonicalList->mNumberBuffers, m_sampleCount);
-    ASSERT(bufferSizes);
-
     m_flatBuffer.resize(bufferSizes->second);
     auto* data = ""
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to