Mercurial > libavcodec.hg
changeset 9283:a37db17a8283 libavcodec
mlpdec: More validation for read_channel_params()
author | ramiro |
---|---|
date | Mon, 30 Mar 2009 03:20:01 +0000 |
parents | 2f82384bbe05 |
children | 4072adff072e |
files | mlpdec.c |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mlpdec.c Mon Mar 30 03:12:39 2009 +0000 +++ b/mlpdec.c Mon Mar 30 03:20:01 2009 +0000 @@ -561,6 +561,11 @@ if (read_filter_params(m, gbp, ch, IIR) < 0) return -1; + if (fir->order + iir->order > 8) { + av_log(m->avctx, AV_LOG_ERROR, "Total filter orders too high.\n"); + return -1; + } + if (fir->order && iir->order && fir->shift != iir->shift) { av_log(m->avctx, AV_LOG_ERROR, @@ -582,9 +587,12 @@ cp->codebook = get_bits(gbp, 2); cp->huff_lsbs = get_bits(gbp, 5); - cp->sign_huff_offset = calculate_sign_huff(m, substr, ch); + if (cp->huff_lsbs > 24) { + av_log(m->avctx, AV_LOG_ERROR, "Invalid huff_lsbs.\n"); + return -1; + } - /* TODO: validate */ + cp->sign_huff_offset = calculate_sign_huff(m, substr, ch); return 0; }