Title: [295499] trunk/Source/WebCore/platform/cocoa/SharedVideoFrameInfo.mm
Revision
295499
Author
commit-qu...@webkit.org
Date
2022-06-13 13:07:44 -0700 (Mon, 13 Jun 2022)

Log Message

Check for null buffers in SharedVideoFrameInfo::writePixelBuffer
https://bugs.webkit.org/show_bug.cgi?id=241544
rdar://94649789

Patch by Youenn Fablet <youe...@gmail.com> on 2022-06-13
Reviewed by Eric Carlson.

* Source/WebCore/platform/cocoa/SharedVideoFrameInfo.mm:
(WebCore::SharedVideoFrameInfo::writePixelBuffer):

Canonical link: https://commits.webkit.org/251504@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/platform/cocoa/SharedVideoFrameInfo.mm (295498 => 295499)


--- trunk/Source/WebCore/platform/cocoa/SharedVideoFrameInfo.mm	2022-06-13 19:52:35 UTC (rev 295498)
+++ trunk/Source/WebCore/platform/cocoa/SharedVideoFrameInfo.mm	2022-06-13 20:07:44 UTC (rev 295499)
@@ -192,11 +192,21 @@
     data += sizeof(SharedVideoFrameInfo);
 
     auto* planeA = static_cast<const uint8_t*>(CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0));
+    if (!planeA) {
+        RELEASE_LOG_ERROR(WebRTC, "SharedVideoFrameInfo::writePixelBuffer plane A is null");
+        return false;
+    }
+
     size_t planeASize = m_height * m_bytesPerRow;
     std::memcpy(data, planeA, planeASize);
 
     if (CVPixelBufferGetPlaneCount(pixelBuffer) == 2) {
         auto* planeB = static_cast<const uint8_t*>(CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 1));
+        if (!planeB) {
+            RELEASE_LOG_ERROR(WebRTC, "SharedVideoFrameInfo::writePixelBuffer plane B is null");
+            return false;
+        }
+
         size_t planeBSize = m_heightPlaneB * m_bytesPerRowPlaneB;
         std::memcpy(data + planeASize, planeB, planeBSize);
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to