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>
release/5.1
Michael Niedermayer 3 years ago
parent c6f1e48b86
commit 8154cb7c2f
  1. 4
      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, ")");

Loading…
Cancel
Save