diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-07-07 23:16:12 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-11-14 23:30:38 +0100 |
commit | 8666a635fdb02bcc1d1fb390df04e92776d17803 (patch) | |
tree | 1365b0b212972eeb4fa932a1464eecc0e461e98a | |
parent | 175def86b7d7765c1c64c635a7ba5ed1957dc718 (diff) | |
download | ffmpeg-8666a635fdb02bcc1d1fb390df04e92776d17803.tar.gz |
avcodec/vorbisdec: amplitude bits can be more than 25 bits
Fixes: assertion failure, invalid shift
Fixes: 15583/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5640157484548096
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 308771a73870863d1b4f630234fbb5bc7aec8252)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/vorbisdec.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index 2a4f482031..2b3fb6c0c0 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -1097,13 +1097,14 @@ static int vorbis_floor0_decode(vorbis_context *vc, { vorbis_floor0 *vf = &vfu->t0; float *lsp = vf->lsp; - unsigned amplitude, book_idx; + unsigned book_idx; + uint64_t amplitude; unsigned blockflag = vc->modes[vc->mode_number].blockflag; if (!vf->amplitude_bits) return 1; - amplitude = get_bits(&vc->gb, vf->amplitude_bits); + amplitude = get_bits64(&vc->gb, vf->amplitude_bits); if (amplitude > 0) { float last = 0; unsigned idx, lsp_len = 0; @@ -1181,7 +1182,7 @@ static int vorbis_floor0_decode(vorbis_context *vc, /* calculate linear floor value */ q = exp((((amplitude*vf->amplitude_offset) / - (((1 << vf->amplitude_bits) - 1) * sqrt(p + q))) + (((1ULL << vf->amplitude_bits) - 1) * sqrt(p + q))) - vf->amplitude_offset) * .11512925f); /* fill vector */ |