[FFmpeg-cvslog] nsvdec: Check av_malloc(string_size)

Michael Niedermayer git at videolan.org
Fri Dec 30 01:56:44 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Dec 29 21:31:22 2011 +0100| [b9e0e9537a3ec4af1630e9f1b8d0ce68885cac16] | committer: Michael Niedermayer

nsvdec: Check av_malloc(string_size)

This can easily be NULL as string_size can be 2g in a damaged file.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/nsvdec.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 72d626a..76bcd4a 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -314,6 +314,8 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
         char quote;
 
         p = strings = av_mallocz(strings_size + 1);
+        if (!p)
+            return AVERROR(ENOMEM);
         endp = strings + strings_size;
         avio_read(pb, strings, strings_size);
         while (p < endp) {



More information about the ffmpeg-cvslog mailing list