Skip to content
Permalink
Browse files
CVPixelBufferGetBytePointerCallback should check for CVPixelBufferGet…
…BaseAddress returning nullptr

https://bugs.webkit.org/show_bug.cgi?id=241845
rdar://95622853

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

CVPixelBufferGetBaseAddress may return nullptr in some cases.
In that case, return early.

* Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp:
(WebCore::CVPixelBufferGetBytePointerCallback):

Canonical link: https://commits.webkit.org/251739@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295734 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf authored and webkit-commit-queue committed Jun 22, 2022
1 parent 273e6e9 commit 5c114d985f2e24cc468fd23e74e51f9dd737cd14
Showing 1 changed file with 6 additions and 0 deletions.
@@ -70,6 +70,12 @@ static const void* CVPixelBufferGetBytePointerCallback(void* refcon)

++info->lockCount;
void* address = CVPixelBufferGetBaseAddress(info->pixelBuffer.get());
if (!address) {
RELEASE_LOG_ERROR(Media, "CVPixelBufferGetBaseAddress returned null");
RELEASE_LOG_STACKTRACE(Media);
return nullptr;
}

size_t byteLength = CVPixelBufferGetBytesPerRow(info->pixelBuffer.get()) * CVPixelBufferGetHeight(info->pixelBuffer.get());

verifyImageBufferIsBigEnough(address, byteLength);

0 comments on commit 5c114d9

Please sign in to comment.