Title: [271733] trunk/Source/WebCore
Revision
271733
Author
cdu...@apple.com
Date
2021-01-21 19:22:03 -0800 (Thu, 21 Jan 2021)

Log Message

Protect against sampleRate being 0 in IIRFilter::tailTime()
https://bugs.webkit.org/show_bug.cgi?id=220837
<rdar://73395924>

Reviewed by Eric Carlson.

* platform/audio/IIRFilter.cpp:
(WebCore::IIRFilter::tailTime):
Return early if sampleRate is 0 (invalid). Add a release assertion to make
sure that numberOfBlocks is greater than 0 since this is the size of the
|magnitude| array and we access magnitude[0] later on.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271732 => 271733)


--- trunk/Source/WebCore/ChangeLog	2021-01-22 03:09:27 UTC (rev 271732)
+++ trunk/Source/WebCore/ChangeLog	2021-01-22 03:22:03 UTC (rev 271733)
@@ -1,3 +1,17 @@
+2021-01-21  Chris Dumez  <cdu...@apple.com>
+
+        Protect against sampleRate being 0 in IIRFilter::tailTime()
+        https://bugs.webkit.org/show_bug.cgi?id=220837
+        <rdar://73395924>
+
+        Reviewed by Eric Carlson.
+
+        * platform/audio/IIRFilter.cpp:
+        (WebCore::IIRFilter::tailTime):
+        Return early if sampleRate is 0 (invalid). Add a release assertion to make
+        sure that numberOfBlocks is greater than 0 since this is the size of the
+        |magnitude| array and we access magnitude[0] later on.
+
 2021-01-21  Nikolas Zimmermann  <nzimmerm...@igalia.com>
 
         REGRESSION (r271559): [BigSur] fast/forms/password-scrolled-after-caps-lock-toggled.html is consistently failing

Modified: trunk/Source/WebCore/platform/audio/IIRFilter.cpp (271732 => 271733)


--- trunk/Source/WebCore/platform/audio/IIRFilter.cpp	2021-01-22 03:09:27 UTC (rev 271732)
+++ trunk/Source/WebCore/platform/audio/IIRFilter.cpp	2021-01-22 03:22:03 UTC (rev 271733)
@@ -172,7 +172,7 @@
     // If filter is not stable, just return max tail. Since the filter is not
     // stable, the impulse response won't converge to zero, so we don't need to
     // find the impulse response to find the actual tail time.
-    if (!isFilterStable)
+    if (!isFilterStable || !sampleRate)
         return maxTailTime;
 
     // How to compute the tail time? We're going to filter an impulse
@@ -188,6 +188,7 @@
 
     // Number of render quanta needed to reach the max tail time.
     int numberOfBlocks = std::ceil(sampleRate * maxTailTime / AudioUtilities::renderQuantumSize);
+    RELEASE_ASSERT(numberOfBlocks);
 
     // Input and output buffers for filtering.
     AudioFloatArray input(AudioUtilities::renderQuantumSize);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to