Commit 320d7197 authored by jbr's avatar jbr

add crc check to ac3 decoder

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@11379 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent b33d0305
......@@ -35,6 +35,7 @@
#include "avcodec.h"
#include "ac3_parser.h"
#include "bitstream.h"
#include "crc.h"
#include "dsputil.h"
#include "random.h"
......@@ -1101,15 +1102,21 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
return -1;
}
avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate;
/* check that reported frame size fits in input buffer */
if(s->frame_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
return -1;
}
/* check for crc mismatch */
if(av_crc(av_crc8005, 0, &buf[2], s->frame_size-2)) {
av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
return -1;
}
avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate;
/* channel config */
s->out_channels = s->channels;
if (avctx->request_channels > 0 && avctx->request_channels <= 2 &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment