Fix division by zero in I420Buffer::CropAndScaleFrom
Bug: webrtc:11741 Change-Id: I5ad495084573e55adb77696e6f61880c1378d0c8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178440 Commit-Queue: Dan Minor <dminor@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31799}
This commit is contained in:
parent
d4089cae47
commit
24a53a05a5
@ -215,9 +215,11 @@ void I420Buffer::CropAndScaleFrom(const I420BufferInterface& src,
|
||||
|
||||
void I420Buffer::CropAndScaleFrom(const I420BufferInterface& src) {
|
||||
const int crop_width =
|
||||
std::min(src.width(), width() * src.height() / height());
|
||||
height() > 0 ? std::min(src.width(), width() * src.height() / height())
|
||||
: src.width();
|
||||
const int crop_height =
|
||||
std::min(src.height(), height() * src.width() / width());
|
||||
width() > 0 ? std::min(src.height(), height() * src.width() / width())
|
||||
: src.height();
|
||||
|
||||
CropAndScaleFrom(src, (src.width() - crop_width) / 2,
|
||||
(src.height() - crop_height) / 2, crop_width, crop_height);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user