Commit 25976f1908 for ffmpeg
commit 25976f1908dcd700ed224c3421e0bbf9804d0188
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Tue Sep 22 18:34:17 2026 +0200
avutil/tests/pca: fix unsigned wraparound in the generated samples
av_lfg_get() % 101 - 50 is evaluated as unsigned. Assigned to an int it
wraps back to the intended range, but v[0] is a double and received
values near 4e9, which put the covariances around 4e18.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/libavutil/tests/pca.c b/libavutil/tests/pca.c
index a2a620799a..fcf59759db 100644
--- a/libavutil/tests/pca.c
+++ b/libavutil/tests/pca.c
@@ -41,8 +41,8 @@ int main(void){
double v[2*LEN+100];
// double sum=0;
int pos = av_lfg_get(&prng) % LEN;
- int v2 = av_lfg_get(&prng) % 101 - 50;
- v[0] = av_lfg_get(&prng) % 101 - 50;
+ int v2 = (int)(av_lfg_get(&prng) % 101) - 50;
+ v[0] = (int)(av_lfg_get(&prng) % 101) - 50;
for(j=1; j<8; j++){
if(j<=pos) v[j]= v[0];
else v[j]= v2;