]> git.sesse.net Git - ffmpeg/commitdiff
avformat/realtextdec: Check for duplicate extradata in realtext_read_header()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 4 Aug 2019 10:21:51 +0000 (12:21 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 5 Aug 2019 15:54:24 +0000 (17:54 +0200)
Fixes: memleak
Fixes: 16140/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5684008052064256
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/realtextdec.c

index e12871e6ad5255bf50d7d4dbcc61f90a7f527b97..204e557aa294816c1f029ff0b7ff7d6ed1d0b7cd 100644 (file)
@@ -87,6 +87,10 @@ static int realtext_read_header(AVFormatContext *s)
             /* save header to extradata */
             const char *p = ff_smil_get_attr_ptr(buf.str, "duration");
 
+            if (st->codecpar->extradata) {
+                res = AVERROR_INVALIDDATA;
+                goto end;
+            }
             if (p)
                 duration = read_ts(p);
             st->codecpar->extradata = av_strdup(buf.str);