[FFmpeg-cvslog] avcodec/tests/jpeg2000dwt: Use 64bit in err2 computation

Michael Niedermayer git at videolan.org
Sun Jun 2 23:32:52 EEST 2024


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun May 19 22:07:31 2024 +0200| [847a53f264db0b22dcc5a23ca9ade71a627f1c6c] | committer: Michael Niedermayer

avcodec/tests/jpeg2000dwt: Use 64bit in err2 computation

This issue cannot happen with the current function parameters

Fixes: CID1500309 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/tests/jpeg2000dwt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/tests/jpeg2000dwt.c b/libavcodec/tests/jpeg2000dwt.c
index 0e5a6ed947..6148f0dacf 100644
--- a/libavcodec/tests/jpeg2000dwt.c
+++ b/libavcodec/tests/jpeg2000dwt.c
@@ -57,7 +57,7 @@ static int test_dwt(int *array, int *ref, int border[2][2], int decomp_levels, i
                     j, array[j], ref[j],decomp_levels, border[0][0], border[0][1], border[1][0], border[1][1]);
             return 2;
         }
-        err2 += (array[j] - ref[j]) * (array[j] - ref[j]);
+        err2 += (array[j] - ref[j]) * (int64_t)(array[j] - ref[j]);
         array[j] = ref[j];
     }
     ff_dwt_destroy(s);



More information about the ffmpeg-cvslog mailing list