[FFmpeg-cvslog] ebml_read_binary: use fast_padded_malloc()

Michael Niedermayer git at videolan.org
Fri Nov 9 23:51:05 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Nov  9 22:58:10 2012 +0100| [c63e76ba3553d7635b92ac3801f3087e85a76bfb] | committer: Michael Niedermayer

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 at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c63e76ba3553d7635b92ac3801f3087e85a76bfb
---

 libavformat/matroskadec.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index ba53e34..ec279ed 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;



More information about the ffmpeg-cvslog mailing list