diff mbox series

[FFmpeg-devel,2/2] avformat/id3v2: Free buffer in decode_str()

Message ID 20230630001655.10242-2-michael@niedermayer.cc
State Accepted
Commit c41ab871c703bc41a4753c784adff1c5fe3795ca
Headers show
Series [FFmpeg-devel,1/2] avcodec/rka: Fix integer overflow in decode_filter() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer June 30, 2023, 12:16 a.m. UTC
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@niedermayer.cc>
---
 libavformat/id3v2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

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;