diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-22 17:31:56 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-22 17:35:20 +0200 |
commit | 49d597f058a9f3a09d272e711d636f5e6829920e (patch) | |
tree | 0cd8a9554564f8a23afa954782d34a1447b4904b /libavcodec/shorten.c | |
parent | 44ebb2556d099c8103247b7c2b60eab399f300af (diff) | |
parent | 9c713f30e4913a28d93eb37ea5db7f62be4c0ef6 (diff) | |
download | ffmpeg-49d597f058a9f3a09d272e711d636f5e6829920e.tar.gz |
Merge commit '9c713f30e4913a28d93eb37ea5db7f62be4c0ef6' into release/0.8
* commit '9c713f30e4913a28d93eb37ea5db7f62be4c0ef6':
parser: fix large overreads
dsputil: fix invalid array indexing
shorten: use the unsigned type where needed
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/shorten.c')
-rw-r--r-- | libavcodec/shorten.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 628dd2f385..2f7c13cedc 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -78,7 +78,7 @@ typedef struct ShortenContext { GetBitContext gb; int min_framesize, max_framesize; - int channels; + unsigned channels; int32_t *decoded[MAX_CHANNELS]; int32_t *decoded_base[MAX_CHANNELS]; @@ -342,6 +342,10 @@ static int shorten_decode_frame(AVCodecContext *avctx, s->internal_ftype = get_uint(s, TYPESIZE); s->channels = get_uint(s, CHANSIZE); + if (!s->channels) { + av_log(s->avctx, AV_LOG_ERROR, "No channels reported\n"); + return AVERROR_INVALIDDATA; + } if (s->channels <= 0 || s->channels > MAX_CHANNELS) { av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels); s->channels = 0; @@ -507,7 +511,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE); break; case FN_BLOCKSIZE: { - int blocksize = get_uint(s, av_log2(s->blocksize)); + unsigned blocksize = get_uint(s, av_log2(s->blocksize)); if (blocksize > s->blocksize) { av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n"); return AVERROR_PATCHWELCOME; |