[FFmpeg-devel] [PATCH v1 5/8] avformat/mpeg: check av_strdup() return value

Steven Liu lq at chinaffmpeg.org
Thu Oct 10 06:40:08 EEST 2019


Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 libavformat/mpeg.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index bd182e4429..df37692f12 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -898,6 +898,11 @@ static int vobsub_read_header(AVFormatContext *s)
     for (i = 0; i < s->nb_streams; i++) {
         AVStream *sub_st = s->streams[i];
         sub_st->codecpar->extradata      = av_strdup(header_str);
+        if (!sub_st->codecpar->extradata) {
+            ret = AVERROR(ENOMEM);
+            sub_st->codecpar->extradata_size = 0;
+            goto end;
+        }
         sub_st->codecpar->extradata_size = header.len;
     }
     av_free(header_str);
-- 
2.15.1





More information about the ffmpeg-devel mailing list