Only check frame size if the header is valid.
authorJustin Ruggles <justin.ruggles@gmail.com>
Sun, 24 Jan 2010 23:55:33 +0000 (23:55 +0000)
committerJustin Ruggles <justin.ruggles@gmail.com>
Sun, 24 Jan 2010 23:55:33 +0000 (23:55 +0000)
Originally committed as revision 21439 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/ac3dec.c

index ba7ae16..8b78a0a 100644 (file)
@@ -1237,7 +1237,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
     err = parse_frame_header(s);
 
     /* check that reported frame size fits in input buffer */
-    if(s->frame_size > buf_size) {
+    if(!err && s->frame_size > buf_size) {
         av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
         err = AAC_AC3_PARSE_ERROR_FRAME_SIZE;
     }