[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec mpeg12.c,1.239,1.240
Michael Niedermayer CVS
michael
Tue Jul 12 00:15:06 CEST 2005
Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv27630
Modified Files:
mpeg12.c
Log Message:
fix decoding of (broken) files with f_code=0
fix segfault if the first P frames header is damaged
Index: mpeg12.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mpeg12.c,v
retrieving revision 1.239
retrieving revision 1.240
diff -u -d -r1.239 -r1.240
--- mpeg12.c 18 May 2005 19:42:41 -0000 1.239
+++ mpeg12.c 11 Jul 2005 22:15:03 -0000 1.240
@@ -2220,7 +2220,7 @@
if (s->pict_type == P_TYPE || s->pict_type == B_TYPE) {
s->full_pel[0] = get_bits1(&s->gb);
f_code = get_bits(&s->gb, 3);
- if (f_code == 0)
+ if (f_code == 0 && avctx->error_resilience >= FF_ER_COMPLIANT)
return -1;
s->mpeg_f_code[0][0] = f_code;
s->mpeg_f_code[0][1] = f_code;
@@ -2228,7 +2228,7 @@
if (s->pict_type == B_TYPE) {
s->full_pel[1] = get_bits1(&s->gb);
f_code = get_bits(&s->gb, 3);
- if (f_code == 0)
+ if (f_code == 0 && avctx->error_resilience >= FF_ER_COMPLIANT)
return -1;
s->mpeg_f_code[1][0] = f_code;
s->mpeg_f_code[1][1] = f_code;
@@ -3138,8 +3138,12 @@
start_code <= SLICE_MAX_START_CODE) {
int mb_y= start_code - SLICE_MIN_START_CODE;
+ if(s2->last_picture_ptr==NULL){
/* skip b frames if we dont have reference frames */
- if(s2->last_picture_ptr==NULL && s2->pict_type==B_TYPE) break;
+ if(s2->pict_type==B_TYPE) break;
+ /* skip P frames if we dont have reference frame no valid header */
+ if(s2->pict_type==P_TYPE && !s2->first_slice) break;
+ }
/* skip b frames if we are in a hurry */
if(avctx->hurry_up && s2->pict_type==B_TYPE) break;
/* skip everything if we are in a hurry>=5 */
More information about the ffmpeg-cvslog
mailing list