aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/rv30.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-01-12 15:48:39 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-12 15:48:39 +0100
commitce795ac0f53e4c2e50667ac1bef38b82e945e96d (patch)
tree3d559f9046b234d80820c392c1d73f983e048960 /libavcodec/rv30.c
parent5ea2a8d43e692bd4ed61edce3505b49ea65e36ce (diff)
parentc5c7e3e6f7cf17943c04bd078f260eaf789afbc9 (diff)
downloadffmpeg-ce795ac0f53e4c2e50667ac1bef38b82e945e96d.tar.gz
Merge commit 'c5c7e3e6f7cf17943c04bd078f260eaf789afbc9' into release/1.1
* commit 'c5c7e3e6f7cf17943c04bd078f260eaf789afbc9': gifdec: check that the image dimensions are non-zero gifdec: return meaningful error codes. eacmv: check the framerate before setting it. rv30: fix extradata size check. sdp: Check that fmt->oformat is non-null before accessing it matroskadec: use correct compression parameters for current track CodecPrivate vc1: Reset numref if fieldmode is not set Conflicts: libavcodec/gifdec.c libavcodec/rv30.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/rv30.c')
-rw-r--r--libavcodec/rv30.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/rv30.c b/libavcodec/rv30.c
index c40010e3b2..dca42b71e8 100644
--- a/libavcodec/rv30.c
+++ b/libavcodec/rv30.c
@@ -35,6 +35,7 @@
static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceInfo *si)
{
+ AVCodecContext *avctx = r->s.avctx;
int mb_bits;
int w = r->s.width, h = r->s.height;
int mb_size;
@@ -57,6 +58,13 @@ static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceIn
rpr = 0;
}
if(rpr){
+ if (avctx->extradata_size < rpr * 2 + 8) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Insufficient extradata - need at least %d bytes, got %d\n",
+ 8 + rpr * 2, avctx->extradata_size);
+ return AVERROR(EINVAL);
+ }
+
w = r->s.avctx->extradata[6 + rpr*2] << 2;
h = r->s.avctx->extradata[7 + rpr*2] << 2;
}
@@ -260,10 +268,7 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx)
}
r->rpr = (avctx->extradata[1] & 7) >> 1;
r->rpr = FFMIN(r->rpr + 1, 3);
- if(avctx->extradata_size - 8 < (r->rpr - 1) * 2){
- av_log(avctx, AV_LOG_ERROR, "Insufficient extradata - need at least %d bytes, got %d\n",
- 6 + r->rpr * 2, avctx->extradata_size);
- }
+
r->parse_slice_header = rv30_parse_slice_header;
r->decode_intra_types = rv30_decode_intra_types;
r->decode_mb_info = rv30_decode_mb_info;