diff mbox series

[FFmpeg-devel,3/6] avfilter/af_channelmap: disallow channel index 64

Message ID 20240319211504.8342-3-cus@passwd.hu
State Accepted
Commit 2f754a96bd4ae4932923fe03c2d53f8273b6273c
Headers show
Series [FFmpeg-devel,1/6] avfilter/af_channelmap: fix error message if FL source channel was missing | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marton Balint March 19, 2024, 9:15 p.m. UTC
MAX_CH is 64, therefore the maximum index is 63.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/af_channelmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
index 35dc4c4618..1ecbddd462 100644
--- a/libavfilter/af_channelmap.c
+++ b/libavfilter/af_channelmap.c
@@ -84,7 +84,7 @@  static char* split(char *message, char delim) {
     return next;
 }
 
-static int get_channel_idx(char **map, int *ch, char delim, int max_ch)
+static int get_channel_idx(char **map, int *ch, char delim, int max_nb_channels)
 {
     char *next;
     int len;
@@ -98,7 +98,7 @@  static int get_channel_idx(char **map, int *ch, char delim, int max_ch)
     sscanf(*map, "%d%n", ch, &n);
     if (n != len)
         return AVERROR(EINVAL);
-    if (*ch < 0 || *ch > max_ch)
+    if (*ch < 0 || *ch >= max_nb_channels)
         return AVERROR(EINVAL);
     *map = next;
     return 0;