avcodec/binkaudio: clear padding area of packet_buffer
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 1 Jan 2014 02:30:16 +0000 (03:30 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 1 Jan 2014 02:31:09 +0000 (03:31 +0100)
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f0dba198b34_2970_Snd0a3a2ad4.dee
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/binkaudio.c

index 8db4533..ffa32d1 100644 (file)
@@ -306,6 +306,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
         buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
         if (!buf)
             return AVERROR(ENOMEM);
+        memset(buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
         s->packet_buffer = buf;
         memcpy(s->packet_buffer, avpkt->data, avpkt->size);
         if ((ret = init_get_bits8(gb, s->packet_buffer, avpkt->size)) < 0)