avformat/takdec: zero padding area before use
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 7 Jan 2014 18:47:37 +0000 (19:47 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 7 Jan 2014 18:48:13 +0000 (19:48 +0100)
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7fcecee73d71_6470_luckynight-partial.tak
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/takdec.c

index 2ed8a1e..4888a77 100644 (file)
@@ -85,6 +85,7 @@ static int tak_read_header(AVFormatContext *s)
             buffer = av_malloc(size - 3 + FF_INPUT_BUFFER_PADDING_SIZE);
             if (!buffer)
                 return AVERROR(ENOMEM);
+            memset(buffer + size - 3, 0, FF_INPUT_BUFFER_PADDING_SIZE);
 
             ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U);
             if (avio_read(pb, buffer, size - 3) != size - 3) {