[FFmpeg-cvslog] avutil/channel_layout: av_channel_layout_describe_bprint: Check for buffer end

Michael Niedermayer git at videolan.org
Sat Jul 2 20:23:17 EEST 2022


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Jun 30 00:00:32 2022 +0200| [8154cb7c2ff2afcb1a0842de8c215b7714c814d0] | committer: Michael Niedermayer

avutil/channel_layout: av_channel_layout_describe_bprint: Check for buffer end

Fixes: Timeout printing a billion channels
Fixes: 48099/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-6754782204788736

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=8154cb7c2ff2afcb1a0842de8c215b7714c814d0
---

 libavutil/channel_layout.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index 21b70173b7..1887987789 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -757,6 +757,10 @@ int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout,
             if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM &&
                 channel_layout->u.map[i].name[0])
                 av_bprintf(bp, "@%s", channel_layout->u.map[i].name);
+
+            if (!av_bprint_is_complete(bp))
+                return AVERROR(ENOMEM);
+
         }
         if (channel_layout->nb_channels) {
             av_bprintf(bp, ")");



More information about the ffmpeg-cvslog mailing list