[FFmpeg-cvslog] avcodec/wavpack: Fix integer overflow in FFABS

Michael Niedermayer git at videolan.org
Mon Feb 19 16:36:02 EET 2018


ffmpeg | branch: release/3.0 | Michael Niedermayer <michael at niedermayer.cc> | Wed Jan 31 02:50:18 2018 +0100| [8886e1228d1c47cb49212766f7ebf80797dfdaf4] | committer: Michael Niedermayer

avcodec/wavpack: Fix integer overflow in FFABS

Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 5396/clusterfuzz-testcase-minimized-6558555529281536

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 8e50bd61e4ff97bd7fc6cbd7ec4ca514e17a70c4)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 0429adcfe1..34f73fe8f2 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -474,7 +474,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
         }
 
         if (type == AV_SAMPLE_FMT_S16P) {
-            if (FFABS(L) + (unsigned)FFABS(R) > (1<<19)) {
+            if (FFABS((int64_t)L) + FFABS((int64_t)R) > (1<<19)) {
                 av_log(s->avctx, AV_LOG_ERROR, "sample %d %d too large\n", L, R);
                 return AVERROR_INVALIDDATA;
             }



More information about the ffmpeg-cvslog mailing list