aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-11-30 23:08:25 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-11-30 23:08:25 +0000
commit52069c4d3c92f68605fadf012ab0da594ee9bae4 (patch)
tree61877fe925131b52813e172c70ae2ccc4d62ac80 /libavcodec/mpeg12.c
parent77ac76a30f7ce52198fcccfea5e1493755784d5a (diff)
downloadffmpeg-52069c4d3c92f68605fadf012ab0da594ee9bae4.tar.gz
Move "slice below image" check from mpeg_decode_slice to its caller.
Should fix issue1277. Originally committed as revision 20676 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 2e2bc367b1..6680db2328 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1673,10 +1673,7 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
s->resync_mb_x=
s->resync_mb_y= -1;
- if (mb_y >= s->mb_height){
- av_log(s->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s->mb_height);
- return -1;
- }
+ assert(mb_y < s->mb_height);
init_get_bits(&s->gb, *buf, buf_size*8);
@@ -2390,6 +2387,11 @@ static int decode_chunks(AVCodecContext *avctx,
if(s2->picture_structure == PICT_BOTTOM_FIELD)
mb_y++;
+ if (mb_y >= s2->mb_height){
+ av_log(s2->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s2->mb_height);
+ return -1;
+ }
+
if(s2->last_picture_ptr==NULL){
/* Skip B-frames if we do not have reference frames and gop is not closed */
if(s2->pict_type==FF_B_TYPE){