Skip to content
Permalink
Browse files
Check for null buffers in SharedVideoFrameInfo::writePixelBuffer
https://bugs.webkit.org/show_bug.cgi?id=241544
rdar://94649789

Patch by Youenn Fablet <youennf@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
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf authored and webkit-commit-queue committed Jun 13, 2022
1 parent d60c93a commit 719056f0f5504cfe90951988c11243b44025abc5
Showing 1 changed file with 10 additions and 0 deletions.
@@ -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);
}

0 comments on commit 719056f

Please sign in to comment.