aascdec: Check input buffer size on raw data.
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 13 Dec 2011 14:45:04 +0000 (15:45 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 13 Dec 2011 14:45:04 +0000 (15:45 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/aasc.c

index 919bbc7..197bfe5 100644 (file)
@@ -79,8 +79,13 @@ static int aasc_decode_frame(AVCodecContext *avctx,
     case 0:
         stride = (avctx->width * 3 + 3) & ~3;
         for(i = avctx->height - 1; i >= 0; i--){
+            if(avctx->width*3 > buf_size){
+                av_log(avctx, AV_LOG_ERROR, "Next line is beyond buffer bounds\n");
+                break;
+            }
             memcpy(s->frame.data[0] + i*s->frame.linesize[0], buf, avctx->width*3);
             buf += stride;
+            buf_size -= stride;
         }
         break;
     case 1: