Title: [217700] tags/Safari-604.1.23.0.4/Source/WebCore
Revision
217700
Author
[email protected]
Date
2017-06-01 22:32:33 -0700 (Thu, 01 Jun 2017)

Log Message

Merged r217692.  rdar://problem/32514813

Modified Paths

Diff

Modified: tags/Safari-604.1.23.0.4/Source/WebCore/ChangeLog (217699 => 217700)


--- tags/Safari-604.1.23.0.4/Source/WebCore/ChangeLog	2017-06-02 05:30:02 UTC (rev 217699)
+++ tags/Safari-604.1.23.0.4/Source/WebCore/ChangeLog	2017-06-02 05:32:33 UTC (rev 217700)
@@ -1,3 +1,22 @@
+2017-06-01  Babak Shafiei  <[email protected]>
+
+        Merge r217692.
+
+    2017-06-01  Youenn Fablet  <[email protected]>
+
+            LibWebRTC might crash with frames having a null width or height
+            https://bugs.webkit.org/show_bug.cgi?id=172842
+            <rdar://problem/32514813>
+
+            Reviewed by Jon Lee.
+
+            Do not send black frames in case the video width or height is zero.
+            Also ensure that even if a null buffer is returned by the pool, no crash might actually happen.
+
+            * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
+            (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded):
+            (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
+
 2017-05-31  Matthew Hanson  <[email protected]>
 
         Cherry-pick r217624. rdar://problem/32493091

Modified: tags/Safari-604.1.23.0.4/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp (217699 => 217700)


--- tags/Safari-604.1.23.0.4/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp	2017-06-02 05:30:02 UTC (rev 217699)
+++ tags/Safari-604.1.23.0.4/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp	2017-06-02 05:32:33 UTC (rev 217700)
@@ -160,8 +160,16 @@
     if (!m_muted && m_enabled)
         return;
 
+    if (!m_width || !m_height)
+        return;
+
     if (!m_blackFrame) {
         auto frame = m_bufferPool.CreateBuffer(m_width, m_height);
+        ASSERT(frame);
+        if (!frame) {
+            RELEASE_LOG(WebRTC, "RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded unable to send black frames");
+            return;
+        }
         frame->SetToBlack();
         m_blackFrame = WTFMove(frame);
     }
@@ -222,7 +230,15 @@
     CVPixelBufferLockBaseAddress(pixelBuffer, 0);
     auto* source = reinterpret_cast<uint8_t*>(CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0));
 
+    ASSERT(m_width);
+    ASSERT(m_height);
+
     auto newBuffer = m_bufferPool.CreateBuffer(m_width, m_height);
+    ASSERT(newBuffer);
+    if (!newBuffer) {
+        RELEASE_LOG(WebRTC, "RealtimeOutgoingVideoSource::videoSampleAvailable unable to allocate buffer for conversion to YUV");
+        return;
+    }
     if (pixelFormatType == kCVPixelFormatType_32BGRA)
         webrtc::ConvertToI420(webrtc::kARGB, source, 0, 0, m_width, m_height, 0, webrtc::kVideoRotation_0, newBuffer);
     else {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to