diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-08-03 01:50:52 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-08-03 01:50:52 +0000 |
commit | 7440fe839d32b09b0cbf31ec31e69689f5cf3a39 (patch) | |
tree | 1e8ebabad3fa4f98c645d45a8f44f5d09144d443 | |
parent | fa2522d7009fefaacf85855e8f3f4aec9f4ef007 (diff) | |
download | ffmpeg-7440fe839d32b09b0cbf31ec31e69689f5cf3a39.tar.gz |
segfault fix
Originally committed as revision 3376 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/h264.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 4d03945cd2..f9bca7dfc8 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -738,6 +738,9 @@ static inline int check_intra_pred_mode(H264Context *h, int mode){ static const int8_t top [7]= {LEFT_DC_PRED8x8, 1,-1,-1}; static const int8_t left[7]= { TOP_DC_PRED8x8,-1, 2,-1,DC_128_PRED8x8}; + if(mode < 0 || mode > 6) + return -1; + if(!(h->top_samples_available&0x8000)){ mode= top[ mode ]; if(mode<0){ @@ -5136,13 +5139,13 @@ static int decode_slice(H264Context *h){ int ret = decode_mb_cabac(h); int eos = get_cabac_terminate( &h->cabac ); /* End of Slice flag */ - hl_decode_mb(h); + if(ret>=0) hl_decode_mb(h); /* XXX: useless as decode_mb_cabac it doesn't support that ... */ if( ret >= 0 && h->sps.mb_aff ) { //FIXME optimal? or let mb_decode decode 16x32 ? s->mb_y++; - ret = decode_mb_cabac(h); + if(ret>=0) ret = decode_mb_cabac(h); eos = get_cabac_terminate( &h->cabac ); hl_decode_mb(h); @@ -5180,13 +5183,13 @@ static int decode_slice(H264Context *h){ for(;;){ int ret = decode_mb_cavlc(h); - hl_decode_mb(h); + if(ret>=0) hl_decode_mb(h); if(ret>=0 && h->sps.mb_aff){ //FIXME optimal? or let mb_decode decode 16x32 ? s->mb_y++; ret = decode_mb_cavlc(h); - hl_decode_mb(h); + if(ret>=0) hl_decode_mb(h); s->mb_y--; } |