diff options
author | Martin Storsjö <martin@martin.st> | 2013-09-28 00:22:52 +0300 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-10-04 03:52:09 +0200 |
commit | 78aa2ed620178044a227fbbe48f749c0dc86023f (patch) | |
tree | 83e2b04739d483298f44070ba7cc5848aa294097 | |
parent | 2ff935a06008fb1959ff633962fbc728762c33cb (diff) | |
download | ffmpeg-78aa2ed620178044a227fbbe48f749c0dc86023f.tar.gz |
alac: Do bounds checking of lpc_order read from the bitstream
In lpc_prediction(), we write up to array element 'lpc_order' in
an array allocated to hold 'max_samples_per_frame' elements.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 59480abce7e4238e22b3a4a904a9fe6abf4e4188)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r-- | libavcodec/alac.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 72e9353b54..139e352ad3 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -315,6 +315,9 @@ static int decode_element(AVCodecContext *avctx, void *data, int ch_index, rice_history_mult[ch] = get_bits(&alac->gb, 3); lpc_order[ch] = get_bits(&alac->gb, 5); + if (lpc_order[ch] >= alac->max_samples_per_frame) + return AVERROR_INVALIDDATA; + /* read the predictor table */ for (i = lpc_order[ch] - 1; i >= 0; i--) lpc_coefs[ch][i] = get_sbits(&alac->gb, 16); |