[FFmpeg-cvslog] avcodec/wavpack: Avoid undefined shift in get_tail()

Michael Niedermayer git at videolan.org
Thu Feb 23 23:20:28 EET 2023


ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Sun Dec 18 17:55:09 2022 +0100| [194a9429b2543609364a26af72e6d3f1d7bc1934] | committer: Michael Niedermayer

avcodec/wavpack: Avoid undefined shift in get_tail()

Fixes: left shift of 1208485947 by 1 places cannot be represented in type 'int'
Fixes: 54058/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5827521084260352

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 8374a747af247d45eb466fcb4aee90f3ae798aad)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 45c49518f2..32eb2d46bf 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -129,7 +129,7 @@ static av_always_inline unsigned get_tail(GetBitContext *gb, int k)
     e   = (1 << (p + 1)) - k - 1;
     res = get_bitsz(gb, p);
     if (res >= e)
-        res = (res << 1) - e + get_bits1(gb);
+        res = res * 2U - e + get_bits1(gb);
     return res;
 }
 



More information about the ffmpeg-cvslog mailing list