[FFmpeg-cvslog] avformat/4xm: Cleanup on GET_LIST_HEADER() failure

Michael Niedermayer git at videolan.org
Sun Jul 5 20:51:02 EEST 2020


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jun  7 21:35:43 2020 +0200| [13f9cfbf2b4c898e1628b55c8228a53bc9b8cd94] | committer: Michael Niedermayer

avformat/4xm: Cleanup on GET_LIST_HEADER() failure

Fixes: memleak
Fixes: 23142/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5932860820422656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit a5313ce6542a4ee4112acd260e59bff698f3dddd)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/4xm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 260e080962..1f1156c78a 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -58,8 +58,10 @@
 #define GET_LIST_HEADER() \
     fourcc_tag = avio_rl32(pb); \
     size       = avio_rl32(pb); \
-    if (fourcc_tag != LIST_TAG) \
-        return AVERROR_INVALIDDATA; \
+    if (fourcc_tag != LIST_TAG) { \
+        ret = AVERROR_INVALIDDATA; \
+        goto fail; \
+    } \
     fourcc_tag = avio_rl32(pb);
 
 typedef struct AudioTrack {
@@ -201,7 +203,7 @@ static int fourxm_read_header(AVFormatContext *s)
     unsigned int size;
     int header_size;
     FourxmDemuxContext *fourxm = s->priv_data;
-    unsigned char *header;
+    unsigned char *header = NULL;
     int i, ret;
 
     fourxm->track_count = 0;



More information about the ffmpeg-cvslog mailing list