diff options
author | wm4 <wm4@nowhere> | 2015-06-06 21:06:54 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-06-06 21:06:54 +0200 |
commit | fb7d0c80cc6375a513ad7a2ebd34272b99078018 (patch) | |
tree | e912ce369753eacfca4073e8c5c6d09ecaaa5018 /video/out/vo_vdpau.c | |
parent | 57048c7393e94820520a395e569d05cdcc085224 (diff) | |
download | mpv-fb7d0c80cc6375a513ad7a2ebd34272b99078018.tar.bz2 mpv-fb7d0c80cc6375a513ad7a2ebd34272b99078018.tar.xz |
vo_vdpau: add a NULL check, verify image dimensions
read_output_surface() could fail and return NULL.
Also, make sure we don't set the image to a size larger than the
allocated size. Normally this shouldn't happen, but in theory it could
in corner cases; this is for robustness.
Diffstat (limited to 'video/out/vo_vdpau.c')
-rw-r--r-- | video/out/vo_vdpau.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index c211b558ab..495e65a9b9 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -881,7 +881,8 @@ static struct mp_image *get_window_screenshot(struct vo *vo) int last_surface = WRAP_ADD(vc->surface_num, -1, vc->num_output_surfaces); VdpOutputSurface screen = vc->output_surfaces[last_surface]; struct mp_image *image = read_output_surface(vo, screen); - mp_image_set_size(image, vo->dwidth, vo->dheight); + if (image && image->w >= vo->dwidth && image->h >= vo->dheight) + mp_image_set_size(image, vo->dwidth, vo->dheight); return image; } |