diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-09 22:58:10 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-09 23:35:58 +0100 |
commit | c63e76ba3553d7635b92ac3801f3087e85a76bfb (patch) | |
tree | 633c60872d607b6ae09a9f308903a9bad56e5e3b | |
parent | 98b377004d9c6fa1c1756c814efe9882b65f96b9 (diff) | |
download | ffmpeg-c63e76ba3553d7635b92ac3801f3087e85a76bfb.tar.gz |
ebml_read_binary: use fast_padded_malloc()
Fixes out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/matroskadec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index ba53e342da..ec279ed3c9 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -762,8 +762,8 @@ static int ebml_read_ascii(AVIOContext *pb, int size, char **str) */ static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) { - av_free(bin->data); - if (!(bin->data = av_malloc(length))) + av_fast_padded_malloc(&bin->data, &bin->size, length); + if (!bin->data) return AVERROR(ENOMEM); bin->size = length; |