summaryrefslogtreecommitdiff
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2007-09-15 02:44:28 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2007-09-15 02:44:28 +0000
commita135bea5077369afb2dd684b4b329895bbd31271 (patch)
treed7b883c2fc88a7cceed56e02b89006bb603fa94d /libavcodec/ac3dec.c
parent3df880934e721d7e37e4feb1d4a3f226cfc1bf2d (diff)
skip incomplete frames
Originally committed as revision 10497 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 70c4d93450..6fd1e479bf 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1120,6 +1120,12 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
avctx->sample_rate = ctx->sampling_rate;
avctx->bit_rate = ctx->bit_rate;
+ /* check that reported frame size fits in input buffer */
+ if(ctx->frame_size > buf_size) {
+ av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
+ return -1;
+ }
+
/* channel config */
ctx->out_channels = ctx->nchans;
if (avctx->channels == 0) {