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
This commit is contained in:
Dan Minor 2019-12-24 19:45:51 +00:00
Родитель 2f2d1f7fc1
Коммит fad95a456d
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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,