[FFmpeg-cvslog] avformat/mov: Fix memleak in dref reading

Michael Niedermayer git at videolan.org
Fri Nov 27 01:27:48 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Oct 30 21:44:12 2020 +0100| [3b8a263c4f0e750f809282b9e6830c125d6c9db3] | committer: Michael Niedermayer

avformat/mov: Fix memleak in dref reading

Fixes: leak in mov_read_dref()
Fixes: 26698/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5638785444085760
Fixes: 27554/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6256643054239744

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mov.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2b90e31170..175d5a3cc2 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -588,6 +588,11 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         entries >= UINT_MAX / sizeof(*sc->drefs))
         return AVERROR_INVALIDDATA;
 
+    for (i = 0; i < sc->drefs_count; i++) {
+        MOVDref *dref = &sc->drefs[i];
+        av_freep(&dref->path);
+        av_freep(&dref->dir);
+    }
     av_free(sc->drefs);
     sc->drefs_count = 0;
     sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));



More information about the ffmpeg-cvslog mailing list