Commit 50e61c78 authored by Thomas Guilbert's avatar Thomas Guilbert Committed by Commit Bot

Fix VideoFrame ctor crash

This CL fixes VideoFrame constructor crash, when it is passed a closed
ImageBitmap. This happens because the passed pointer is valid, but we
use ImageBitmap::ImageBitmap() without checking its returns value.

Change-Id: I04858a194026f3448e40a62d556153c32c8bdde1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2357458
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Auto-Submit: Thomas Guilbert <tguilbert@chromium.org>
Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798385}
parent 8da4dca1
......@@ -97,17 +97,18 @@ VideoFrame* VideoFrame::Create(ImageBitmap* source,
"No source was provided");
return nullptr;
}
gfx::Size size(source->width(), source->height());
gfx::Rect rect(size);
base::TimeDelta timestamp =
base::TimeDelta::FromMicroseconds(init->timestamp());
if (!source) {
if (!source->BitmapImage()) {
exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError,
"Invalid source state");
return nullptr;
}
gfx::Size size(source->width(), source->height());
gfx::Rect rect(size);
base::TimeDelta timestamp =
base::TimeDelta::FromMicroseconds(init->timestamp());
auto sk_image =
source->BitmapImage()->PaintImageForCurrentFrame().GetSkImage();
auto sk_color_space = sk_image->refColorSpace();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment