Browse Source

avcodec/ac3dec: check bap before use.

Fixes out of array read
Fixes assertion failure
Fixes asan_static-oob_16431c0_8036_rio_bravo_mono_64_spx.ac3

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.2-rc1
Michael Niedermayer 11 years ago
parent
commit
4782c4284f
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      libavcodec/ac3dec.c

+ 4
- 0
libavcodec/ac3dec.c View File

@@ -497,6 +497,10 @@ static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, ma
break; break;
default: /* 6 to 15 */ default: /* 6 to 15 */
/* Shift mantissa and sign-extend it. */ /* Shift mantissa and sign-extend it. */
if (bap > 15) {
av_log(s->avctx, AV_LOG_ERROR, "bap %d is invalid in plain AC-3\n", bap);
bap = 15;
}
mantissa = get_sbits(gbc, quantization_tab[bap]); mantissa = get_sbits(gbc, quantization_tab[bap]);
mantissa <<= 24 - quantization_tab[bap]; mantissa <<= 24 - quantization_tab[bap];
break; break;


Loading…
Cancel
Save