From 34b223d730c97225accae4107a032c9b7ebf2194 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 5 Jul 2015 23:55:47 +0200 Subject: mp_image: make image writeable before overwriting palette This is an obscure but theoretically possible bug. --- video/mp_image.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'video/mp_image.c') diff --git a/video/mp_image.c b/video/mp_image.c index dc305a4b63..3816e297ad 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -364,8 +364,10 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src) } mp_image_params_guess_csp(&dst->params); // ensure colorspace consistency if ((dst->fmt.flags & MP_IMGFLAG_PAL) && (src->fmt.flags & MP_IMGFLAG_PAL)) { - if (dst->planes[1] && src->planes[1]) - memcpy(dst->planes[1], src->planes[1], MP_PALETTE_SIZE); + if (dst->planes[1] && src->planes[1]) { + if (mp_image_make_writeable(dst)) + memcpy(dst->planes[1], src->planes[1], MP_PALETTE_SIZE); + } } } -- cgit v1.2.3