[FFmpeg-cvslog] alac: Do bounds checking of lpc_order read from the bitstream

Martin Storsjö git at videolan.org
Sun Sep 29 23:21:54 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sat Sep 28 00:22:52 2013 +0300| [59480abce7e4238e22b3a4a904a9fe6abf4e4188] | committer: Martin Storsjö

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 at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59480abce7e4238e22b3a4a904a9fe6abf4e4188
---

 libavcodec/alac.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 41d1f77..6d1ace3 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -314,6 +314,9 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, 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);



More information about the ffmpeg-cvslog mailing list