[FFmpeg-devel] [PATCH 09/13] avformat/realtextdec: Check for duplicate extradata in realtext_read_header()

Michael Niedermayer michael at niedermayer.cc
Sun Aug 4 19:44:12 EEST 2019


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 at niedermayer.cc>
---
 libavformat/realtextdec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/realtextdec.c b/libavformat/realtextdec.c
index e12871e6ad..204e557aa2 100644
--- a/libavformat/realtextdec.c
+++ b/libavformat/realtextdec.c
@@ -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);
-- 
2.22.0



More information about the ffmpeg-devel mailing list