mirror of
https://github.com/mpv-player/mpv
synced 2024-12-30 02:52:10 +00:00
mp_image: make image writeable before overwriting palette
This is an obscure but theoretically possible bug.
This commit is contained in:
parent
95424517a2
commit
34b223d730
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user