[FFmpeg-cvslog] adxdec: Check available space before decoding block.

Michael Niedermayer git at videolan.org
Mon Apr 16 02:23:52 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Apr 16 01:57:36 2012 +0200| [8dfb13ea59f87365f407dfe4fc196b50e3fad92b] | committer: Michael Niedermayer

adxdec: Check available space before decoding block.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/adxdec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index ec4b104..630b795 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -100,6 +100,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
     ADXContext *c       = avctx->priv_data;
     int16_t *samples;
     const uint8_t *buf  = avpkt->data;
+    const uint8_t *buf_end = buf + avpkt->size;
     int num_blocks, ch, ret;
 
     if (c->eof) {
@@ -148,7 +149,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
 
     while (num_blocks--) {
         for (ch = 0; ch < c->channels; ch++) {
-            if (adx_decode(c, samples + ch, buf, ch)) {
+            if (buf_end - buf < BLOCK_SIZE || adx_decode(c, samples + ch, buf, ch)) {
                 c->eof = 1;
                 buf = avpkt->data + avpkt->size;
                 break;



More information about the ffmpeg-cvslog mailing list