[FFmpeg-cvslog] avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds

Michael Niedermayer git at videolan.org
Mon Jul 8 00:39:41 EEST 2024


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Jun 10 21:58:51 2024 +0200| [cef720ab429244ac9e56f48d983d6086e0a227a7] | committer: Michael Niedermayer

avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds

Maybe Helps: CID1503077 Bad bit shift operation

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cef720ab429244ac9e56f48d983d6086e0a227a7
---

 libavfilter/af_channelsplit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c
index 1c4e815c6e..43b2667750 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);



More information about the ffmpeg-cvslog mailing list