ffmpeg | branch: release/4.3 | Michael Niedermayer <[email protected]> | 
Fri May 17 00:46:24 2024 +0200| [9bd68c46a6c0ca6495b8ec838fbc8e0aa1363f64] | 
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 <[email protected]>
(cherry picked from commit 161d0aa2a8d18f1f8a01cbc4c1061eadcbe592e5)
Signed-off-by: Michael Niedermayer <[email protected]>

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

 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 2ca8039c01..36a4c38a55 100644
--- a/libavcodec/tests/dct.c
+++ b/libavcodec/tests/dct.c
@@ -222,8 +222,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)

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to