aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-16 15:53:27 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-14 23:30:37 +0100
commit7887aa79de9c78ff56934ce4ece2df74b75f718a (patch)
tree779200d2b20466ce5f3e3200e854a23caa6e1fe9
parent6aa01c06252a225073e7275aca0bd0b5f4db740a (diff)
downloadffmpeg-7887aa79de9c78ff56934ce4ece2df74b75f718a.tar.gz
avcodec/qdmc: Fix integer overflows in PRNG
Fixes: signed integer overflow: 214013 * 2531011 cannot be represented in type 'int' Fixes: 15254/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDMC_fuzzer-5698137026461696 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 2921b45a388a81968d946996bb32e72d7bb5d5b7) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/qdmc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c
index 1c8952b97b..f4d63cd8b8 100644
--- a/libavcodec/qdmc.c
+++ b/libavcodec/qdmc.c
@@ -571,9 +571,9 @@ static void add_noise(QDMCContext *s, int ch, int current_subframe)
for (j = 2; j < s->subframe_size - 1; j++) {
float rnd_re, rnd_im;
- s->rndval = 214013 * s->rndval + 2531011;
+ s->rndval = 214013U * s->rndval + 2531011;
rnd_im = ((s->rndval & 0x7FFF) - 16384.0f) * 0.000030517578f * s->noise2_buffer[j];
- s->rndval = 214013 * s->rndval + 2531011;
+ s->rndval = 214013U * s->rndval + 2531011;
rnd_re = ((s->rndval & 0x7FFF) - 16384.0f) * 0.000030517578f * s->noise2_buffer[j];
im[j ] += rnd_im;
re[j ] += rnd_re;