[FFmpeg-cvslog] avformat/id3v2: Free buffer in decode_str()

Michael Niedermayer git at videolan.org
Sat Jul 22 18:55:15 EEST 2023


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Jun 30 01:57:03 2023 +0200| [c41ab871c703bc41a4753c784adff1c5fe3795ca] | committer: Michael Niedermayer

avformat/id3v2: Free buffer in decode_str()

Fixes: memleak
Fixes: 60058/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5665259244093440

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=c41ab871c703bc41a4753c784adff1c5fe3795ca
---

 libavformat/id3v2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 38c86a8e79..69193933e0 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -309,8 +309,10 @@ static int decode_str(AVFormatContext *s, AVIOContext *pb, int encoding,
         avio_w8(dynbuf, 0);
 
     dynsize = avio_close_dyn_buf(dynbuf, dst);
-    if (dynsize <= 0)
+    if (dynsize <= 0) {
+        av_freep(dst);
         return AVERROR(ENOMEM);
+    }
     *maxread = left;
 
     return 0;



More information about the ffmpeg-cvslog mailing list