diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2009-04-18 18:51:43 +0000 |
---|---|---|
committer | Ramiro Polla <ramiro.polla@gmail.com> | 2009-04-18 18:51:43 +0000 |
commit | 5d9e4eaa6d991718b24c7ce24318ee91419f593a (patch) | |
tree | f91aedc5e326287710820afd6a199b68fe39328d | |
parent | 1b7bc4a2455f7efc8b29e6f9c2dc22eff3c84e27 (diff) | |
download | ffmpeg-5d9e4eaa6d991718b24c7ce24318ee91419f593a.tar.gz |
mlpdec: Check for {matrix,filter}_changed as soon as they are incremented.
Originally committed as revision 18610 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/mlpdec.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index e74d146af0..596e0a2c79 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -446,7 +446,10 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp, // Filter is 0 for FIR, 1 for IIR. assert(filter < 2); - m->filter_changed[channel][filter]++; + if (m->filter_changed[channel][filter]++ > 1) { + av_log(m->avctx, AV_LOG_ERROR, "Filters may change only once per access unit.\n"); + return -1; + } order = get_bits(gbp, 4); if (order > max_order) { @@ -508,8 +511,12 @@ static int read_matrix_params(MLPDecodeContext *m, SubStream *s, GetBitContext * { unsigned int mat, ch; + if (m->matrix_changed++ > 1) { + av_log(m->avctx, AV_LOG_ERROR, "Matrices may change only once per access unit.\n"); + return -1; + } + s->num_primitive_matrices = get_bits(gbp, 4); - m->matrix_changed++; for (mat = 0; mat < s->num_primitive_matrices; mat++) { int frac_bits, max_chan; @@ -1013,8 +1020,6 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size, s->blockpos = 0; do { - unsigned int ch; - if (get_bits1(&gb)) { if (get_bits1(&gb)) { /* A restart header should be present. */ @@ -1031,17 +1036,6 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size, goto next_substr; } - if (m->matrix_changed > 1) { - av_log(m->avctx, AV_LOG_ERROR, "Matrices may change only once per access unit.\n"); - goto next_substr; - } - for (ch = 0; ch < s->max_channel; ch++) - if (m->filter_changed[ch][FIR] > 1 || - m->filter_changed[ch][IIR] > 1) { - av_log(m->avctx, AV_LOG_ERROR, "Filters may change only once per access unit.\n"); - goto next_substr; - } - if (!s->restart_seen) { goto next_substr; } |