mirror of https://github.com/mpv-player/mpv
mp_image: copy palette only if allocated
Normally, we assume that IMGFMT_PAL8 always has a palette allocated in plane 1. But there may be corner cases in ffmpeg where it doesn't (namely pseudo-pal stuff).
This commit is contained in:
parent
9e80fe1c15
commit
823e0c511b
|
@ -327,7 +327,8 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src)
|
|||
dst->levels = src->levels;
|
||||
}
|
||||
if (dst->imgfmt == IMGFMT_PAL8 && src->imgfmt == IMGFMT_PAL8) {
|
||||
memcpy(dst->planes[1], src->planes[1], MP_PALETTE_SIZE);
|
||||
if (dst->planes[1] && src->planes[1])
|
||||
memcpy(dst->planes[1], src->planes[1], MP_PALETTE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue