Browse Source

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 308771a738)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.8.16
Michael Niedermayer 6 years ago
parent
commit
b217b8ed59
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      libavcodec/vorbisdec.c

+ 4
- 3
libavcodec/vorbisdec.c View File

@@ -1097,13 +1097,14 @@ static int vorbis_floor0_decode(vorbis_context *vc,
{ {
vorbis_floor0 *vf = &vfu->t0; vorbis_floor0 *vf = &vfu->t0;
float *lsp = vf->lsp; float *lsp = vf->lsp;
unsigned amplitude, book_idx;
unsigned book_idx;
uint64_t amplitude;
unsigned blockflag = vc->modes[vc->mode_number].blockflag; unsigned blockflag = vc->modes[vc->mode_number].blockflag;


if (!vf->amplitude_bits) if (!vf->amplitude_bits)
return 1; return 1;


amplitude = get_bits(&vc->gb, vf->amplitude_bits);
amplitude = get_bits64(&vc->gb, vf->amplitude_bits);
if (amplitude > 0) { if (amplitude > 0) {
float last = 0; float last = 0;
unsigned idx, lsp_len = 0; unsigned idx, lsp_len = 0;
@@ -1181,7 +1182,7 @@ static int vorbis_floor0_decode(vorbis_context *vc,


/* calculate linear floor value */ /* calculate linear floor value */
q = exp((((amplitude*vf->amplitude_offset) / 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); - vf->amplitude_offset) * .11512925f);


/* fill vector */ /* fill vector */


Loading…
Cancel
Save