[FFmpeg-cvslog] avcodec/mjpegdec: Clear palette to avoid uninitialized entries
Michael Niedermayer
git at videolan.org
Mon May 3 22:35:27 EEST 2021
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon May 3 21:03:07 2021 +0200| [c83f60d7d7818948d014d6f9ab0a2e77371bb439] | committer: Michael Niedermayer
avcodec/mjpegdec: Clear palette to avoid uninitialized entries
Suggested-by: James
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c83f60d7d7818948d014d6f9ab0a2e77371bb439
---
libavcodec/mjpegdec.c | 4 ++++
1 file changed, 4 insertions(+)
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;
More information about the ffmpeg-cvslog
mailing list