diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-01-04 00:34:52 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-01-04 00:39:51 +0100 |
commit | 3cf1503beb35203ef4b9ddef5a2bc8b6f919eb12 (patch) | |
tree | eb027b9ab20bb5dd6b89a1ca4eeab99ab600ec4d | |
parent | 532b93b51631ee58443bee8aec7c2a2b2a1746be (diff) | |
parent | a6a2282c25abe43e352010a7c3fbc92994c0bc1c (diff) | |
download | ffmpeg-3cf1503beb35203ef4b9ddef5a2bc8b6f919eb12.tar.gz |
Merge commit 'a6a2282c25abe43e352010a7c3fbc92994c0bc1c'
* commit 'a6a2282c25abe43e352010a7c3fbc92994c0bc1c':
rv30: fix extradata size check.
Conflicts:
libavcodec/rv30.c
See: 09c5f990bc7629dfbee8c760fd485936c60a7b40
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/rv30.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/rv30.c b/libavcodec/rv30.c index 7690da70cd..9e27270c78 100644 --- a/libavcodec/rv30.c +++ b/libavcodec/rv30.c @@ -34,6 +34,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; @@ -50,12 +51,14 @@ static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceIn skip_bits1(gb); si->pts = get_bits(gb, 13); rpr = get_bits(gb, r->rpr); - if (r->s.avctx->extradata_size < 8 + rpr*2) { - av_log(r->s.avctx, AV_LOG_WARNING, - "Extradata does not contain selected resolution\n"); - 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; } @@ -259,10 +262,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; |