[FFmpeg-devel] [PATCH] avfilter/af_amerge: avoid undefined shift (<<64) in outlayout setup

Michael Niedermayer michaelni at gmx.at
Fri Sep 4 00:33:49 CEST 2015


From: Michael Niedermayer <michael at niedermayer.cc>

Fixes CID1322306

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavfilter/af_amerge.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index 9c3cfed..410d613 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -110,8 +110,8 @@ static int query_formats(AVFilterContext *ctx)
         for (i = 0; i < nb_ch; i++)
             s->route[i] = i;
         outlayout = av_get_default_channel_layout(nb_ch);
-        if (!outlayout)
-            outlayout = ((int64_t)1 << nb_ch) - 1;
+        if (!outlayout && nb_ch)
+            outlayout = 0xFFFFFFFFFFFFFFFFULL >> (64 - nb_ch);
     } else {
         int *route[SWR_CH_MAX];
         int c, out_ch_number = 0;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list