From d88d0370d51a1fe243837ee22ae4395c519c8c1e Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sat, 9 Oct 2021 01:39:46 +0200 Subject: [PATCH] avfilter/af_axcorrelate: fix integer overflow for huge segments --- libavfilter/af_axcorrelate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_axcorrelate.c b/libavfilter/af_axcorrelate.c index d9ef853b69..e0c37cb8ac 100644 --- a/libavfilter/af_axcorrelate.c +++ b/libavfilter/af_axcorrelate.c @@ -82,7 +82,7 @@ static float xcorrelate(const float *x, const float *y, float sumx, float sumy, } num /= size; - den = sqrtf((den0 * den1) / (size * size)); + den = sqrtf((den0 * den1) / size / size); return den <= 1e-6f ? 0.f : num / den; } @@ -149,7 +149,7 @@ static int xcorrelate_fast(AVFilterContext *ctx, AVFrame *out, int available) float num, den; num = num_sum[0] / size; - den = sqrtf((den_sumx[0] * den_sumy[0]) / (size * size)); + den = sqrtf((den_sumx[0] * den_sumy[0]) / size / size); dst[n] = den <= 1e-6f ? 0.f : num / den;