aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-04-11 22:53:03 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-04-11 22:53:03 +0000
commit37b787f124a3a5025253858d1dd1ec30f1e263e4 (patch)
treef2020c818b1b3a5f65d7ac8a90c9f5fc500775a1 /libavcodec/mpeg12.c
parent9c00c3af90c120742461d5217d7b276f7f512e70 (diff)
downloadffmpeg-37b787f124a3a5025253858d1dd1ec30f1e263e4.tar.gz
some checks to avoid segfaults if the decoder is feeded with junk
Originally committed as revision 1757 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index c5b39e1c92..7250226fd3 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1858,6 +1858,12 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
}
}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 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
/* 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);