aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-05-03 21:03:07 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-05-03 21:34:22 +0200
commitc83f60d7d7818948d014d6f9ab0a2e77371bb439 (patch)
treee0c402ddcb8e74ef7d01ce704df04453b937e7b6 /libavcodec
parent7f6ada4eea089bbcb3ac3ff5d7e8c55c98b47740 (diff)
downloadffmpeg-c83f60d7d7818948d014d6f9ab0a2e77371bb439.tar.gz
avcodec/mjpegdec: Clear palette to avoid uninitialized entries
Suggested-by: James Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mjpegdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 0691148027..500cd373bc 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -730,6 +730,10 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
s->picture_ptr->key_frame = 1;
s->got_picture = 1;
+ // Lets clear the palette to avoid leaving uninitialized values in it
+ if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8)
+ memset(s->picture_ptr->data[1], 0, 1024);
+
for (i = 0; i < 4; i++)
s->linesize[i] = s->picture_ptr->linesize[i] << s->interlaced;