changeset 5681:ed3e9456f295 libavcodec

skip incomplete frames
author jbr
date Sat, 15 Sep 2007 02:44:28 +0000
parents 5ae5a74b0e4b
children 8bf94c994691
files ac3dec.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ac3dec.c	Sat Sep 15 02:41:24 2007 +0000
+++ b/ac3dec.c	Sat Sep 15 02:44:28 2007 +0000
@@ -1120,6 +1120,12 @@
     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) {