# HG changeset patch # User michaelni # Date 1050101583 0 # Node ID 38e8b8f331cb8637d302bd6b6f49091549c333ab # Parent 4c2339f3863a4921530c85664f6d7d96178ab3ea some checks to avoid segfaults if the decoder is feeded with junk diff -r 4c2339f3863a -r 38e8b8f331cb mpeg12.c --- a/mpeg12.c Fri Apr 11 21:15:17 2003 +0000 +++ b/mpeg12.c Fri Apr 11 22:53:03 2003 +0000 @@ -1858,6 +1858,12 @@ } }else{ //second field int i; + + if(!s->current_picture_ptr){ + fprintf(stderr, "first field missing\n"); + return -1; + } + for(i=0; i<4; i++){ s->current_picture.data[i] = s->current_picture_ptr->data[i]; if(s->picture_structure == PICT_BOTTOM_FIELD){ @@ -2266,6 +2272,8 @@ /* skip everything if we are in a hurry>=5 */ if(avctx->hurry_up>=5) break; + if (!s->mpeg_enc_ctx_allocated) break; + ret = mpeg_decode_slice(avctx, picture, start_code, s->buffer, input_size);