1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

swscale/graph: copy the palette of a PAL8 frame as a whole

Fixes: NwCWHv3RIJff
Fixes: use of uninitialized memory
Use of uninitialized memory Replicated through API with MSAN
Found during triage of the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24851
This commit is contained in:
Michael Niedermayer
2026-10-13 06:06:59 +02:00
committed by michaelni
parent dd98bbe096
commit 3a75cd0ad3

View File

@@ -290,6 +290,12 @@ static void run_copy(const SwsFrame *out, const SwsFrame *in, int y, int h,
const int lines = h >> ff_fmt_vshift(in->format, i);
av_assert1(in_data[i]);
if (i == 1 && av_pix_fmt_desc_get(in->format)->flags & AV_PIX_FMT_FLAG_PAL) {
if (!y && in->data[1] != out->data[1])
memcpy(out->data[1], in->data[1], AVPALETTE_SIZE);
break;
}
if (in_data[i] == out_data[i]) {
av_assert0(in->linesize[i] == out->linesize[i]);
} else if (in->linesize[i] == out->linesize[i]) {