diff mbox series

[FFmpeg-devel,2/4] avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds

Message ID 20240611134422.3172010-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure | expand

Checks

Context Check Description
yinshiyou/make_fate_loongarch64 success Make fate finished
yinshiyou/make_loongarch64 warning New warnings during build
andriy/make_fate_x86 success Make fate finished
andriy/make_x86 warning New warnings during build

Commit Message

Michael Niedermayer June 11, 2024, 1:44 p.m. UTC
Maybe Helps: CID1503077 Bad bit shift operation

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/af_channelsplit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c
index 1c4e815c6ef..43b26677505 100644
--- a/libavfilter/af_channelsplit.c
+++ b/libavfilter/af_channelsplit.c
@@ -22,7 +22,7 @@ 
  *
  * Split an audio stream into per-channel streams.
  */
-
+#include "libavutil/avassert.h"
 #include "libavutil/attributes.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/internal.h"
@@ -157,6 +157,8 @@  static int filter_frame(AVFilterLink *outlink, AVFrame *buf)
     enum AVChannel channel = av_channel_layout_channel_from_index(&buf->ch_layout, s->map[i]);
     int ret;
 
+    av_assert1(channel >= 0);
+
     AVFrame *buf_out = av_frame_clone(buf);
     if (!buf_out)
         return AVERROR(ENOMEM);