aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-09-10 20:52:48 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-10 20:52:48 +0200
commit7db7eb08e051d0d95215f645e0cfa9a5879cded0 (patch)
tree62fb724f4bc8fd03e521ef797d42e61708310f14 /libavcodec
parent60599c68b04ec9d8b09750dd3f45f6ce92e61d35 (diff)
parent8bfea4ab4e2cb32bc7bf6f697ee30a238c65d296 (diff)
downloadffmpeg-7db7eb08e051d0d95215f645e0cfa9a5879cded0.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: Fixed segfault with wavpack decoder on corrupted decorrelation terms sub-blocks. avconv: move audio_channels to the options context. avconv: move *_disable to options context. avconv: remove -[vas]lang options. avconv: move codec tags to options context. cljr: init_get_bits size in bits instead of bytes indeo2: fail if input buffer too small indeo2: init_get_bits size in bits instead of bytes ffv1: Fixed size given to init_get_bits() in decoder. Conflicts: avconv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/cljr.c2
-rw-r--r--libavcodec/indeo2.c10
-rw-r--r--libavcodec/wavpack.c5
3 files changed, 12 insertions, 5 deletions
diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c
index 2e7fd51f1f..8af149fa58 100644
--- a/libavcodec/cljr.c
+++ b/libavcodec/cljr.c
@@ -67,7 +67,7 @@ static int decode_frame(AVCodecContext *avctx,
p->pict_type= AV_PICTURE_TYPE_I;
p->key_frame= 1;
- init_get_bits(&a->gb, buf, buf_size);
+ init_get_bits(&a->gb, buf, buf_size * 8);
for(y=0; y<avctx->height; y++){
uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ];
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index 30d4758064..f7798e307d 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -153,6 +153,13 @@ static int ir2_decode_frame(AVCodecContext *avctx,
return -1;
}
+ start = 48; /* hardcoded for now */
+
+ if (start >= buf_size) {
+ av_log(s->avctx, AV_LOG_ERROR, "input buffer size too small (%d)\n", buf_size);
+ return AVERROR_INVALIDDATA;
+ }
+
s->decode_delta = buf[18];
/* decide whether frame uses deltas or not */
@@ -160,9 +167,8 @@ static int ir2_decode_frame(AVCodecContext *avctx,
for (i = 0; i < buf_size; i++)
buf[i] = av_reverse[buf[i]];
#endif
- start = 48; /* hardcoded for now */
- init_get_bits(&s->gb, buf + start, buf_size - start);
+ init_get_bits(&s->gb, buf + start, (buf_size - start) * 8);
if (s->decode_delta) { /* intraframe */
ir2_decode_plane(s, avctx->width, avctx->height,
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 582e2cf8c0..253a9560f8 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -863,12 +863,13 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
}
switch(id & WP_IDF_MASK){
case WP_ID_DECTERMS:
- s->terms = size;
- if(s->terms > MAX_TERMS){
+ if(size > MAX_TERMS){
av_log(avctx, AV_LOG_ERROR, "Too many decorrelation terms\n");
+ s->terms = 0;
buf += ssize;
continue;
}
+ s->terms = size;
for(i = 0; i < s->terms; i++) {
s->decorr[s->terms - i - 1].value = (*buf & 0x1F) - 5;
s->decorr[s->terms - i - 1].delta = *buf >> 5;