From 53c430415a65cb4097bdb59b924aaa09bc5e2bb2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 29 Dec 2011 21:31:22 +0100 Subject: [PATCH] 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 (cherry picked from commit b9e0e9537a3ec4af1630e9f1b8d0ce68885cac16) Signed-off-by: Michael Niedermayer --- libavformat/nsvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 72d626af73..76bcd4a5ea 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) {