]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/af_surround: check for invalid magnitude and phase difference
authorPaul B Mahol <onemda@gmail.com>
Wed, 24 Apr 2019 12:36:59 +0000 (14:36 +0200)
committerPaul B Mahol <onemda@gmail.com>
Wed, 24 Apr 2019 20:31:02 +0000 (22:31 +0200)
libavfilter/af_surround.c

index bae13322bb83b44c4dfac0a58dcd22673fe8e599..bccea2b938e62e10c3b95ce79a99ef123fb630e0 100644 (file)
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/avassert.h"
 #include "libavutil/audio_fifo.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/opt.h"
@@ -335,6 +336,8 @@ static void stereo_transform(float *x, float *y, float angle)
 
 static void stereo_position(float a, float p, float *x, float *y)
 {
+    av_assert2(a >= -1.f && a <= 1.f);
+    av_assert2(p >= 0.f && p <= M_PI);
     *x = av_clipf(a+FFMAX(0, sinf(p-M_PI_2))*FFDIFFSIGN(a,0), -1, 1);
     *y = av_clipf(cosf(a*M_PI_2+M_PI)*cosf(M_PI_2-p/M_PI)*M_LN10+1, -1, 1);
 }