[NUT-devel] [PATCH 4/7] avformat/au: cleanup on EOF return in au_read_annotation()

Michael Niedermayer michael at niedermayer.cc
Fri Nov 6 01:10:24 EET 2020


Fixes: memleak
Fixes: 26841/clusterfuzz-testcase-minimized-ffmpeg_dem_AU_fuzzer-5174166309044224

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/au.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/au.c b/libavformat/au.c
index b4eb4f8477..4f2b81119f 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -84,8 +84,11 @@ static int au_read_annotation(AVFormatContext *s, int size)
     av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED);
 
     while (size-- > 0) {
-        if (avio_feof(pb))
+        if (avio_feof(pb)) {
+            av_bprint_finalize(&bprint, NULL);
+            av_freep(&key);
             return AVERROR_EOF;
+        }
         c = avio_r8(pb);
         switch(state) {
         case PARSE_KEY:
-- 
2.17.1



More information about the NUT-devel mailing list