diff options
author | wm4 <wm4@nowhere> | 2016-02-12 16:04:26 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-02-12 16:04:26 +0100 |
commit | 1cfcc1e1d5831d73eaf20a942e800b89bc7598b5 (patch) | |
tree | a403eaec4d6b9796c6ddc0fddf1d91fbc71672c4 /video/mp_image.c | |
parent | 0b427c54adad8c776bad8bdb0fd244fccc625c68 (diff) | |
download | mpv-1cfcc1e1d5831d73eaf20a942e800b89bc7598b5.tar.bz2 mpv-1cfcc1e1d5831d73eaf20a942e800b89bc7598b5.tar.xz |
mp_image: force display size to at least 1x1
Don't allow rounding to let it underflow to 0. 0 width or height is
simply not allowed and could cause problems otherwhere.
Indirectly fixes CID 1350057, which complains about not checking the
resulting output size values before using it in divisions.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index 33badba3f7..ff81dd7666 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -487,9 +487,9 @@ void mp_image_params_get_dsize(const struct mp_image_params *p, *d_w = p->w; *d_h = p->h; if (p->p_w > p->p_h && p->p_h >= 1) - *d_w = MPCLAMP(*d_w * (int64_t)p->p_w / p->p_h, 0, INT_MAX); + *d_w = MPCLAMP(*d_w * (int64_t)p->p_w / p->p_h, 1, INT_MAX); if (p->p_h > p->p_w && p->p_w >= 1) - *d_h = MPCLAMP(*d_h * (int64_t)p->p_h / p->p_w, 0, INT_MAX); + *d_h = MPCLAMP(*d_h * (int64_t)p->p_h / p->p_w, 1, INT_MAX); } void mp_image_params_set_dsize(struct mp_image_params *p, int d_w, int d_h) |