diff options
author | wm4 <wm4@nowhere> | 2015-03-23 18:38:19 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-03-23 18:38:19 +0100 |
commit | e52f7d3da8c7d76a4d1ae7c41fef60eaf2b77db1 (patch) | |
tree | 562466f39e2fc552ae2fb6cbf6799f3c22100b10 | |
parent | cfb5e0cea6508b087e32dd1a15f915d61214c8e1 (diff) |
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).
-rw-r--r-- | video/mp_image.c | 3 |
1 files changed, 1 insertions, 2 deletions
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) |