summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-06-30 00:00:32 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-07-02 19:22:36 +0200
commit8154cb7c2ff2afcb1a0842de8c215b7714c814d0 (patch)
tree97007716cb8c6134be4e3e31f0fae3239f14080c /libavutil
parentc6f1e48b86471b1cc91c468e78a065075ed409bd (diff)
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@niedermayer.cc>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/channel_layout.c4
1 files changed, 4 insertions, 0 deletions
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, ")");