Merge commit '0025f7408a0fab2cab4a950064e4784a67463994'

* commit '0025f7408a0fab2cab4a950064e4784a67463994':
  vorbis: Check the vlc value in setup_classifs

Conflicts:
	libavcodec/vorbisdec.c

See: ae038c0914
See: 709cae2bcb
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-03-08 19:09:32 +01:00
commit acfb54c076
1 changed files with 15 additions and 20 deletions

View File

@ -1329,7 +1329,7 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
int p, j, i;
unsigned c_p_c = codebook->dimensions;
unsigned inverse_class = ff_inverse[vr->classifications];
unsigned temp, temp2;
int temp, temp2;
for (p = 0, j = 0; j < ch_used; ++j) {
if (!do_not_decode[j]) {
temp = get_vlc2(&vc->gb, codebook->vlc.table,
@ -1337,27 +1337,22 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
av_dlog(NULL, "Classword: %u\n", temp);
if ((int)temp < 0)
return temp;
av_assert0(temp < 65536);
if (temp < 0) {
av_log(vc->avctx, AV_LOG_ERROR,
"Invalid vlc code decoding %d channel.", j);
return AVERROR_INVALIDDATA;
}
av_assert0(vr->classifications > 1); //needed for inverse[]
if (temp <= 65536) {
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
temp2 = (((uint64_t)temp) * inverse_class) >> 32;
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
temp2 = (((uint64_t)temp) * inverse_class) >> 32;
if (i < ptns_to_read)
vr->classifs[p + i] = temp - temp2 * vr->classifications;
temp = temp2;
}
} else {
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
temp2 = temp / vr->classifications;
if (i < ptns_to_read)
vr->classifs[p + i] = temp - temp2 * vr->classifications;
temp = temp2;
}
if (i < ptns_to_read)
vr->classifs[p + i] = temp - temp2 * vr->classifications;
temp = temp2;
}
}
p += ptns_to_read;
@ -1413,8 +1408,8 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
voffset = vr->begin;
for (partition_count = 0; partition_count < ptns_to_read;) { // SPEC error
if (!pass) {
int ret;
if ((ret = setup_classifs(vc, vr, do_not_decode, ch_used, partition_count, ptns_to_read)) < 0)
int ret = setup_classifs(vc, vr, do_not_decode, ch_used, partition_count, ptns_to_read);
if (ret < 0)
return ret;
}
for (i = 0; (i < c_p_c) && (partition_count < ptns_to_read); ++i) {