Mercurial > libavcodec.hg
comparison mpeg12.c @ 1182:38e8b8f331cb libavcodec
some checks to avoid segfaults if the decoder is feeded with junk
author | michaelni |
---|---|
date | Fri, 11 Apr 2003 22:53:03 +0000 |
parents | 4c2339f3863a |
children | 2e06398e4647 |
comparison
equal
deleted
inserted
replaced
1181:4c2339f3863a | 1182:38e8b8f331cb |
---|---|
1856 s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors, | 1856 s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors, |
1857 s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" :""); | 1857 s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" :""); |
1858 } | 1858 } |
1859 }else{ //second field | 1859 }else{ //second field |
1860 int i; | 1860 int i; |
1861 | |
1862 if(!s->current_picture_ptr){ | |
1863 fprintf(stderr, "first field missing\n"); | |
1864 return -1; | |
1865 } | |
1866 | |
1861 for(i=0; i<4; i++){ | 1867 for(i=0; i<4; i++){ |
1862 s->current_picture.data[i] = s->current_picture_ptr->data[i]; | 1868 s->current_picture.data[i] = s->current_picture_ptr->data[i]; |
1863 if(s->picture_structure == PICT_BOTTOM_FIELD){ | 1869 if(s->picture_structure == PICT_BOTTOM_FIELD){ |
1864 s->current_picture.data[i] += s->current_picture_ptr->linesize[i]; | 1870 s->current_picture.data[i] += s->current_picture_ptr->linesize[i]; |
1865 } | 1871 } |
2264 /* skip b frames if we are in a hurry */ | 2270 /* skip b frames if we are in a hurry */ |
2265 if(avctx->hurry_up && s2->pict_type==B_TYPE) break; | 2271 if(avctx->hurry_up && s2->pict_type==B_TYPE) break; |
2266 /* skip everything if we are in a hurry>=5 */ | 2272 /* skip everything if we are in a hurry>=5 */ |
2267 if(avctx->hurry_up>=5) break; | 2273 if(avctx->hurry_up>=5) break; |
2268 | 2274 |
2275 if (!s->mpeg_enc_ctx_allocated) break; | |
2276 | |
2269 ret = mpeg_decode_slice(avctx, picture, | 2277 ret = mpeg_decode_slice(avctx, picture, |
2270 start_code, s->buffer, input_size); | 2278 start_code, s->buffer, input_size); |
2271 | 2279 |
2272 if (ret == DECODE_SLICE_EOP) { | 2280 if (ret == DECODE_SLICE_EOP) { |
2273 *data_size = sizeof(AVPicture); | 2281 *data_size = sizeof(AVPicture); |