[FFmpeg-devel] [PATCH 3/4] avformat/img2dec: ensure input padding is zeroed

Kacper Michajłow kasper93 at gmail.com
Thu Jun 27 03:40:36 EEST 2024


Fixes use of uninitialized value, reported by MSAN. Specifically in
jpegxl parser.

Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow <kasper93 at gmail.com>
---
 libavformat/img2dec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index ba52353074..c667d8574c 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -549,6 +549,8 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
         }
     }
 
+    memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+
     if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) {
         if (ret[0] < 0) {
             res = ret[0];
-- 
2.43.0



More information about the ffmpeg-devel mailing list