From e52f7d3da8c7d76a4d1ae7c41fef60eaf2b77db1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 23 Mar 2015 18:38:19 +0100 Subject: mp_image: reject 0-sized images Like FFmpeg/Libav do. It seems not all code can actually deal with this situation, so it's better to shift the special-cases to code which needs it (possibly OSD code; screenshots of 0x0 windows would just fail). --- video/mp_image.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'video/mp_image.c') diff --git a/video/mp_image.c b/video/mp_image.c index fd94f31dea..0e378cb311 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -473,8 +473,7 @@ bool mp_image_params_valid(const struct mp_image_params *p) // ints. We also should (for now) do the same as FFmpeg, to be sure large // images don't crash with libswscale or when wrapping with AVFrame and // passing the result to filters. - // Unlike FFmpeg, consider 0x0 valid (might be needed for OSD/screenshots). - if (p->w < 0 || p->h < 0 || (p->w + 128LL) * (p->h + 128LL) >= INT_MAX / 8) + if (p->w <= 0 || p->h <= 0 || (p->w + 128LL) * (p->h + 128LL) >= INT_MAX / 8) return false; if (p->d_w <= 0 || p->d_h <= 0) -- cgit v1.2.3