[FFmpeg-cvslog] avcodec/dpcm: fix undefined interger overflow in wady

Michael Niedermayer git at videolan.org
Sat May 6 01:26:54 EEST 2023


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Apr 16 17:45:41 2023 +0200| [8f0e200a12c25e288acd31eff0a5000bc74aa34e] | committer: Michael Niedermayer

avcodec/dpcm: fix undefined interger overflow in wady

Fixes: signed integer overflow: -2147375930 + -133875 cannot be represented in type 'int'
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WADY_DPCM_fuzzer-6703727013920768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c
index 6ea9e2c065..eff6587404 100644
--- a/libavcodec/dpcm.c
+++ b/libavcodec/dpcm.c
@@ -444,7 +444,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
             if (n & 0x80)
                 s->sample[idx] = sign_extend((n & 0x7f) << 9, 16);
             else
-                s->sample[idx] += s->scale * wady_table[n & 0x7f];
+                s->sample[idx] += s->scale * (unsigned)wady_table[n & 0x7f];
             *output_samples++ = av_clip_int16(s->sample[idx]);
             idx ^= stereo;
         }



More information about the ffmpeg-cvslog mailing list