[FFmpeg-cvslog] avcodec/tests/dct: Use 64bit in intermediate for error computation

Michael Niedermayer git at videolan.org
Thu Jun 13 23:41:56 EEST 2024


ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Fri May 17 00:46:24 2024 +0200| [9e46b70436305ee77f8087bf24239a1d704f95ed] | committer: Michael Niedermayer

avcodec/tests/dct: Use 64bit in intermediate for error computation

Fixes: CID1500284 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 161d0aa2a8d18f1f8a01cbc4c1061eadcbe592e5)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/tests/dct.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/tests/dct.c b/libavcodec/tests/dct.c
index c847af2f11..fca36283c4 100644
--- a/libavcodec/tests/dct.c
+++ b/libavcodec/tests/dct.c
@@ -224,8 +224,8 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed, c
             v = abs(err);
             if (v > err_inf)
                 err_inf = v;
-            err2_matrix[i] += v * v;
-            err2 += v * v;
+            err2_matrix[i] += v * (int64_t)v;
+            err2 += v * (int64_t)v;
             sysErr[i] += block[i] - block1[i];
             blockSumErr += v;
             if (abs(block[i]) > maxout)



More information about the ffmpeg-cvslog mailing list