Title: [279296] trunk/Source/WebCore
Revision
279296
Author
[email protected]
Date
2021-06-25 12:51:34 -0700 (Fri, 25 Jun 2021)

Log Message

Fix null crash in AudioMediaStreamTrackRendererCocoa::start
https://bugs.webkit.org/show_bug.cgi?id=227386
<rdar://79045120>

Patch by Alex Christensen <[email protected]> on 2021-06-25
Reviewed by Youenn Fablet.

AudioMediaStreamTrackRendererInternalUnitManager::Proxy::~Proxy calls those callbacks with nullptr.
So can LocalAudioMediaStreamTrackRendererInternalUnit::retrieveFormatDescription when createAudioUnitIfNeeded
has an early return or hasn't been called yet.

When this happens, let's not crash.

* platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp:
(WebCore::AudioMediaStreamTrackRendererCocoa::start):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (279295 => 279296)


--- trunk/Source/WebCore/ChangeLog	2021-06-25 19:06:51 UTC (rev 279295)
+++ trunk/Source/WebCore/ChangeLog	2021-06-25 19:51:34 UTC (rev 279296)
@@ -1,3 +1,20 @@
+2021-06-25  Alex Christensen  <[email protected]>
+
+        Fix null crash in AudioMediaStreamTrackRendererCocoa::start
+        https://bugs.webkit.org/show_bug.cgi?id=227386
+        <rdar://79045120>
+
+        Reviewed by Youenn Fablet.
+
+        AudioMediaStreamTrackRendererInternalUnitManager::Proxy::~Proxy calls those callbacks with nullptr.
+        So can LocalAudioMediaStreamTrackRendererInternalUnit::retrieveFormatDescription when createAudioUnitIfNeeded
+        has an early return or hasn't been called yet.
+
+        When this happens, let's not crash.
+
+        * platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp:
+        (WebCore::AudioMediaStreamTrackRendererCocoa::start):
+
 2021-06-25  Philippe Normand  <[email protected]>
 
         WIRELESS_PLAYBACK_TARGET guards protect unrelated code

Modified: trunk/Source/WebCore/platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp (279295 => 279296)


--- trunk/Source/WebCore/platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp	2021-06-25 19:06:51 UTC (rev 279295)
+++ trunk/Source/WebCore/platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp	2021-06-25 19:51:34 UTC (rev 279296)
@@ -45,7 +45,7 @@
     clear();
 
     AudioMediaStreamTrackRendererUnit::singleton().retrieveFormatDescription([weakThis = makeWeakPtr(this), callback = WTFMove(callback)](auto* formatDescription) mutable {
-        if (weakThis)
+        if (weakThis && formatDescription)
             weakThis->m_outputDescription = makeUnique<CAAudioStreamDescription>(*formatDescription);
         callback();
     });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to