Commit 875f8831 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  vorbisdec: Accept 0 amplitude_bits
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents f7dc6aa5 23bd9ef4
...@@ -608,13 +608,6 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) ...@@ -608,13 +608,6 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
floor_setup->data.t0.amplitude_bits = get_bits(gb, 6); floor_setup->data.t0.amplitude_bits = get_bits(gb, 6);
/* zero would result in a div by zero later *
* 2^0 - 1 == 0 */
if (!floor_setup->data.t0.amplitude_bits) {
av_log(vc->avccontext, AV_LOG_ERROR,
"Floor 0 amplitude bits is 0.\n");
return AVERROR_INVALIDDATA;
}
floor_setup->data.t0.amplitude_offset = get_bits(gb, 8); floor_setup->data.t0.amplitude_offset = get_bits(gb, 8);
floor_setup->data.t0.num_books = get_bits(gb, 4) + 1; floor_setup->data.t0.num_books = get_bits(gb, 4) + 1;
...@@ -1065,6 +1058,9 @@ static int vorbis_floor0_decode(vorbis_context *vc, ...@@ -1065,6 +1058,9 @@ static int vorbis_floor0_decode(vorbis_context *vc,
unsigned amplitude, book_idx; unsigned amplitude, book_idx;
unsigned blockflag = vc->modes[vc->mode_number].blockflag; unsigned blockflag = vc->modes[vc->mode_number].blockflag;
if (!vf->amplitude_bits)
return 1;
amplitude = get_bits(&vc->gb, vf->amplitude_bits); amplitude = get_bits(&vc->gb, vf->amplitude_bits);
if (amplitude > 0) { if (amplitude > 0) {
float last = 0; float last = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment