soxdec: check av_malloc return.
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Dec 2011 18:11:49 +0000 (19:11 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Jan 2012 18:49:56 +0000 (19:49 +0100)
Bug found by: durandal_1707

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1dcce49e10dcebde9d2cc52565fa299c5fdfd691)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/soxdec.c

index 45607ec..62e7016 100644 (file)
@@ -98,6 +98,8 @@ static int sox_read_header(AVFormatContext *s,
 
     if (comment_size && comment_size < UINT_MAX) {
         char *comment = av_malloc(comment_size+1);
+        if(!comment)
+            return AVERROR(ENOMEM);
         if (avio_read(pb, comment, comment_size) != comment_size) {
             av_freep(&comment);
             return AVERROR(EIO);