aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Strasser <eclipse7@gmx.net>2011-09-24 18:23:38 +0200
committerAlexander Strasser <eclipse7@gmx.net>2011-09-25 17:16:44 +0200
commitbaad01d8b4bfe63c7c4e571ed553f7845d78d9c0 (patch)
treeb9ebf10903eeac381aa7de201a24db9d9eab71cb
parent715f259bf949b06df1b5ed0307606dc258754c99 (diff)
downloadffmpeg-baad01d8b4bfe63c7c4e571ed553f7845d78d9c0.tar.gz
h264: improve checks before calling ff_h264_decode_extradata
The ff_h264_decode_extradata routine now checks for the buffer size and pointer internally. This makes it possible to remove the external checks in ff_h264_decode_init. In decode_frame there was a size check missing because the buffer gets tested prior to the invocation of ff_h264_decode_extradata(). Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
-rw-r--r--libavcodec/h264.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 1924f364b6..7d16688e4f 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1083,8 +1083,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx){
avctx->ticks_per_frame = 2;
}
- if(avctx->extradata_size > 0 && avctx->extradata &&
- ff_h264_decode_extradata(h, avctx->extradata, avctx->extradata_size))
+ if(ff_h264_decode_extradata(h, avctx->extradata, avctx->extradata_size))
return -1;
if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames < h->sps.num_reorder_frames){
@@ -3918,7 +3917,7 @@ static int decode_frame(AVCodecContext *avctx,
return 0;
}
- if(h->is_avc && AV_RB32(buf)==0x0164001F && buf[5] && buf[8]==0x67)
+ if(h->is_avc && buf_size >= 9 && AV_RB32(buf)==0x0164001F && buf[5] && buf[8]==0x67)
return ff_h264_decode_extradata(h, buf, buf_size);
buf_index=decode_nal_units(h, buf, buf_size);