# HG changeset patch # User michael # Date 1111856509 0 # Node ID 0afef2899701aa5f626e0b390bac3a15df6b2dab # Parent 9973475ccf1e7224089023bf7e2ec38d115e5263 more checks, fixes assertion failure diff -r 9973475ccf1e -r 0afef2899701 mpeg12.c --- a/mpeg12.c Wed Mar 23 19:19:59 2005 +0000 +++ b/mpeg12.c Sat Mar 26 17:01:49 2005 +0000 @@ -1080,6 +1080,15 @@ s->mb_skiped = 1; s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; } else { + int mb_type; + + if(s->mb_x) + mb_type= s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1]; + else + mb_type= s->current_picture.mb_type[ s->mb_width + (s->mb_y-1)*s->mb_stride - 1]; // FIXME not sure if this is allowed in mpeg at all, + if(IS_INTRA(mb_type)) + return -1; + /* if B type, reuse previous vectors and directions */ s->mv[0][0][0] = s->last_mv[0][0][0]; s->mv[0][0][1] = s->last_mv[0][0][1]; @@ -1087,7 +1096,7 @@ s->mv[1][0][1] = s->last_mv[1][0][1]; s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= - s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1] | MB_TYPE_SKIP; + mb_type | MB_TYPE_SKIP; // assert(s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1]&(MB_TYPE_16x16|MB_TYPE_16x8)); if((s->mv[0][0][0]|s->mv[0][0][1]|s->mv[1][0][0]|s->mv[1][0][1])==0) @@ -2104,6 +2113,8 @@ ref = get_bits(&s->gb, 10); /* temporal ref */ s->pict_type = get_bits(&s->gb, 3); + if(s->pict_type == 0 || s->pict_type > 3) + return -1; vbv_delay= get_bits(&s->gb, 16); if (s->pict_type == P_TYPE || s->pict_type == B_TYPE) { @@ -2125,8 +2136,8 @@ s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == I_TYPE; -// if(avctx->debug & FF_DEBUG_PICT_INFO) -// av_log(avctx, AV_LOG_DEBUG, "vbv_delay %d, ref %d\n", vbv_delay, ref); + if(avctx->debug & FF_DEBUG_PICT_INFO) + av_log(avctx, AV_LOG_DEBUG, "vbv_delay %d, ref %d type:%d\n", vbv_delay, ref, s->pict_type); s->y_dc_scale = 8; s->c_dc_scale = 8;