[FFmpeg-cvslog] avcodec/wmalosslessdec: Fix 2 overflows in mclms

2020-04-23 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Wed Nov 20 22:05:40 2019 +0100| [45eef1be3a42d9fb548d39a27af00343ff412866] | 
committer: Michael Niedermayer

avcodec/wmalosslessdec: Fix 2 overflows in mclms

Fixes: signed integer overflow: 2038337026 + 109343477 cannot be represented in 
type 'int'
Fixes: 
18886/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5673660505653248

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 92455c8c65c403ea696cb8c63d474d386d631bbd)
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 2b064e5f76..8fb08fb36d 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -625,7 +625,7 @@ static void mclms_update(WmallDecodeCtx *s, int icoef, int 
*pred)
 int range= 1 << (s->bits_per_sample - 1);
 
 for (ich = 0; ich < num_channels; ich++) {
-pred_error = s->channel_residues[ich][icoef] - pred[ich];
+pred_error = s->channel_residues[ich][icoef] - (unsigned)pred[ich];
 if (pred_error > 0) {
 for (i = 0; i < order * num_channels; i++)
 s->mclms_coeffs[i + ich * order * num_channels] +=
@@ -677,7 +677,7 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int 
*pred)
  s->mclms_coeffs_cur[i + num_channels * ich];
 pred[ich] += (1 << s->mclms_scaling) >> 1;
 pred[ich] >>= s->mclms_scaling;
-s->channel_residues[ich][icoef] += pred[ich];
+s->channel_residues[ich][icoef] += (unsigned)pred[ich];
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/wmalosslessdec: Fix 2 overflows in mclms

2019-12-14 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Nov 20 22:05:40 2019 +0100| [92455c8c65c403ea696cb8c63d474d386d631bbd] | 
committer: Michael Niedermayer

avcodec/wmalosslessdec: Fix 2 overflows in mclms

Fixes: signed integer overflow: 2038337026 + 109343477 cannot be represented in 
type 'int'
Fixes: 
18886/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5673660505653248

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 7afadaae4a..d4dd0ed4e3 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -628,7 +628,7 @@ static void mclms_update(WmallDecodeCtx *s, int icoef, int 
*pred)
 int range= 1 << (s->bits_per_sample - 1);
 
 for (ich = 0; ich < num_channels; ich++) {
-pred_error = s->channel_residues[ich][icoef] - pred[ich];
+pred_error = s->channel_residues[ich][icoef] - (unsigned)pred[ich];
 if (pred_error > 0) {
 for (i = 0; i < order * num_channels; i++)
 s->mclms_coeffs[i + ich * order * num_channels] +=
@@ -680,7 +680,7 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int 
*pred)
  s->mclms_coeffs_cur[i + num_channels * ich];
 pred[ich] += (1 << s->mclms_scaling) >> 1;
 pred[ich] >>= s->mclms_scaling;
-s->channel_residues[ich][icoef] += pred[ich];
+s->channel_residues[ich][icoef] += (unsigned)pred[ich];
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".