aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-07-08 00:53:21 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-07-08 00:53:21 +0000
commitbba833496586c7b44d1015f4b45b15b863aed476 (patch)
treef266d0102ab2c29279c18d8cf692b64a3bb9c46c /libavcodec/h264.c
parent240ae82c51e1d798a93e201e5b34f3fade84f499 (diff)
downloadffmpeg-bba833496586c7b44d1015f4b45b15b863aed476.tar.gz
overread fix
Originally committed as revision 3294 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index c573b7996b..4d03945cd2 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -5117,7 +5117,7 @@ static int decode_slice(H264Context *h){
ff_init_cabac_states( &h->cabac, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64 );
ff_init_cabac_decoder( &h->cabac,
s->gb.buffer + get_bits_count(&s->gb)/8,
- ( s->gb.size_in_bits - get_bits_count(&s->gb) ) );
+ ( s->gb.size_in_bits - get_bits_count(&s->gb) + 7)/8);
/* calculate pre-state */
for( i= 0; i < 399; i++ ) {
int pre;
@@ -5149,7 +5149,7 @@ static int decode_slice(H264Context *h){
s->mb_y--;
}
- if( ret < 0 ) {
+ if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 1) {
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;