From fad95a456df3a5ea116226e42c6fde3a694d969b Mon Sep 17 00:00:00 2001 From: Dan Minor Date: Tue, 24 Dec 2019 19:45:51 +0000 Subject: [PATCH] Bug 1604497 - Avoid division by zero in I420Buffer::CropAndScaleFrom; r=ng Differential Revision: https://phabricator.services.mozilla.com/D58150 --HG-- extra : moz-landing-system : lando --- media/webrtc/trunk/webrtc/api/video/i420_buffer.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/media/webrtc/trunk/webrtc/api/video/i420_buffer.cc b/media/webrtc/trunk/webrtc/api/video/i420_buffer.cc index d9f73085f671..20af2c2289a7 100644 --- a/media/webrtc/trunk/webrtc/api/video/i420_buffer.cc +++ b/media/webrtc/trunk/webrtc/api/video/i420_buffer.cc @@ -221,10 +221,10 @@ void I420Buffer::CropAndScaleFrom(const I420BufferInterface& src, } void I420Buffer::CropAndScaleFrom(const I420BufferInterface& src) { - const int crop_width = - std::min(src.width(), width() * src.height() / height()); - const int crop_height = - std::min(src.height(), height() * src.width() / width()); + const int crop_width = height() ? + std::min(src.width(), width() * src.height() / height()) : src.width(); + const int crop_height = width() ? + std::min(src.height(), height() * src.width() / width()) : src.height(); CropAndScaleFrom( src,