summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorGusar321 <mobile.leecher@gmail.com>2023-07-21 14:03:20 +0200
committersfan5 <sfan5@live.de>2023-07-22 12:16:29 +0200
commit800d9eaa42d248e8f25503253abaa70b14e5ee0e (patch)
tree4b00f20218459571a113b18bf34443a724b902c0 /video
parentc9064b57c03b65bffd3e5558c0f6e4e756f714c6 (diff)
downloadmpv-800d9eaa42d248e8f25503253abaa70b14e5ee0e.tar.bz2
mpv-800d9eaa42d248e8f25503253abaa70b14e5ee0e.tar.xz
vo_vaapi: fix segfault in draw_osd
When video width is not a multiple of slice size, the last slice will overflow. Fix this by adjusting the width of the last slice to fit within the video. Fixes issue #10436
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_vaapi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c
index 009832c734..0c2d1835bf 100644
--- a/video/out/vo_vaapi.c
+++ b/video/out/vo_vaapi.c
@@ -684,6 +684,10 @@ static void draw_osd(struct vo *vo)
int rw = mp_rect_w(*rc);
int rh = mp_rect_h(*rc);
+ // reduce width of last slice to prevent overflow
+ if (n == num_mod_rc - 1)
+ rw = w - rc->x0;
+
void *src = mp_image_pixel_ptr(osd, 0, rc->x0, rc->y0);
void *dst = vaimg.planes[0] + rc->y0 * vaimg.stride[0] + rc->x0 * 4;