[FFmpeg-cvslog] avfilter/af_axcorrelate: fix integer overflow for huge segments

Paul B Mahol git at videolan.org
Sat Oct 9 02:46:20 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Oct  9 01:39:46 2021 +0200| [d88d0370d51a1fe243837ee22ae4395c519c8c1e] | committer: Paul B Mahol

avfilter/af_axcorrelate: fix integer overflow for huge segments

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

 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;
 



More information about the ffmpeg-cvslog mailing list