Browse code

avformat/flac_picture: clear padding area

aviod use of uninitialized memory

Fixes: asan_heap-oob_1487fa4_4706_cov_364534849_cover_art.flac
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2014/02/01 01:31:21
Showing 1 changed files
... ...
@@ -110,6 +110,7 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
110 110
     if (!(data = av_buffer_alloc(len + FF_INPUT_BUFFER_PADDING_SIZE))) {
111 111
         RETURN_ERROR(AVERROR(ENOMEM));
112 112
     }
113
+    memset(data->data + len, 0, FF_INPUT_BUFFER_PADDING_SIZE);
113 114
     if (avio_read(pb, data->data, len) != len) {
114 115
         av_log(s, AV_LOG_ERROR, "Error reading attached picture data.\n");
115 116
         if (s->error_recognition & AV_EF_EXPLODE)